Skip to content

Instantly share code, notes, and snippets.

View Andrious's full-sized avatar
🏠
Working from home

Andrious Solutions Andrious

🏠
Working from home
View GitHub Profile
@Andrious
Andrious / navigate_with_named_routes.dart
Last active September 29, 2022 22:34
Example of the 'routes table' and the pushedNamed() function.
import 'package:flutter/material.dart';
void main() => runApp(NavigateNamedRoutes());
class NavigateNamedRoutes extends StatelessWidget {
@override
Widget build(BuildContext context) => MaterialApp(
title: 'Named Routes Demo',
initialRoute: '/',
routes: {
@Andrious
Andrious / error_handler.dart
Last active September 20, 2022 21:51
An Flutter Error Handler Routine
import 'dart:async' show runZoned;
import 'dart:isolate' show Isolate, RawReceivePort;
import 'dart:ui' as ui
show
Paragraph,
ParagraphBuilder,
ParagraphConstraints,
ParagraphStyle,
TextStyle;
@Andrious
Andrious / flutter_colorpicker.dart
Created January 15, 2020 18:16
Example of AlertDialog widgets used to pick colors.
// MIT License
//
// Copyright (c) 2018 fuyumi
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom
// the Software is furnished to do so, subject to the following conditions:
@Andrious
Andrious / futurebuilder_mixin.dart
Last active March 24, 2022 21:06
A mixin to supply a 'built-in' FutureBuilder Widget to a State object or any object.
///
/// Supply a FutureBuilder to a State object.
///
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
/// Replace 'dart:io' for Web applications
import 'package:universal_platform/universal_platform.dart';
@Andrious
Andrious / inherited_state_mixin.dart
Last active March 24, 2022 17:45
Attach this Mixin to any State object will provide a built-in InheritedWidget
///
/// Any State object 'with' this mixin has then a built-in InheritedWidget
///
///
import 'package:flutter/material.dart';
///
mixin InheritedStateMixin<T extends StatefulWidget> on State<T> {
/// Traditionally called in the initState() function
void initInheritedState<U extends InheritedWidget>({
@Andrious
Andrious / alarm_manager.dart
Last active March 1, 2022 05:38
A Dart library file that works with the Flutter plugin, android_alarm_manager.
///
/// Copyright (C) 2020 Andrious Solutions
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
@Andrious
Andrious / AdMobAdsExample.dart
Last active November 7, 2021 20:23
AdMob Ads Example
import 'package:flutter/material.dart';
import 'dart:io' show Platform;
import 'package:firebase_admob/firebase_admob.dart';
import 'package:ads/ads.dart';
void main() {
runApp(MyApp());
}
@Andrious
Andrious / mediaQuery.dart
Last active September 27, 2021 08:36
A simple app demonstrating the MediaQuery widget
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) => MaterialApp(
title: 'MediaQuery Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
@Andrious
Andrious / GridViewBuilder.dart
Created December 4, 2019 04:13
GridView.builder constructor example
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
@Andrious
Andrious / ColorSliverAppBar.dart
Created May 15, 2019 02:22
Change size and colour of SliverAppBar
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
MyApp({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
final title = 'Floating App Bar';