Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Andrious Solutions Andrious

🏠
Working from home
View GitHub Profile
@Andrious
Andrious / navigate_with_named_routes.dart
Last active Jan 8, 2021
Example of the 'routes table' and the pushedNamed() function.
View navigate_with_named_routes.dart
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 / navigate_two_routes.dart
Last active Jan 6, 2021
Demonstration of Flutter's Naviagtion system
View navigate_two_routes.dart
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(
title: 'Navigation Basics',
home: FirstRoute(),
));
class FirstRoute extends StatelessWidget {
@override
Widget build(BuildContext context) => Scaffold(
@Andrious
Andrious / app_counter_inherited.dart
Last active Dec 30, 2020
Simple startup app (counter app) demonstrating the InheritedWidget
View app_counter_inherited.dart
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key);
@override
Widget build(BuildContext context) => MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
@Andrious
Andrious / mediaQuery.dart
Last active Dec 23, 2020
A simple app demonstrating the MediaQuery widget
View mediaQuery.dart
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 / counter_app_minimum.dart
Created Dec 10, 2020
The proverbial 'counter app' stripped of its many comments.
View counter_app_minimum.dart
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) => MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
@Andrious
Andrious / write_your_first_app_bloc.dart
Last active Dec 3, 2020
Write Your First App with a BLoC
View write_your_first_app_bloc.dart
import 'dart:io' show Platform;
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'
show
CupertinoApp,
CupertinoButton,
CupertinoColors,
CupertinoPageRoute,
@Andrious
Andrious / bloc_state.dart
Created Nov 30, 2020
A Business Logic Component with access to the State object.
View bloc_state.dart
import 'package:flutter/material.dart';
class Bloc extends StateSetter {
//
Bloc([StateBloc state]) : super() {
// Associate it with the specified State object.
addState(state);
// Include it in a collection of Blocs.
@Andrious
Andrious / const_counter_app
Last active Nov 25, 2020
The Counter app with const constructors
View const_counter_app
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key);
@override
Widget build(BuildContext context) => MaterialApp(
theme: ThemeData(
@Andrious
Andrious / theme_controller.dart
Created Nov 3, 2020
Class to supply 'dark mode' ThemeData and record the dark mode setting using the Preference plugin.
View theme_controller.dart
import 'package:flutter/material.dart' show ThemeData;
import 'package:prefs/prefs.dart';
/// The App's theme controller
class ThemeController {
factory ThemeController() => _this ??= ThemeController._();
ThemeController._() {
_isDarkmode = Prefs.getBool('darkmode', false);
}
@Andrious
Andrious / form_validation.dart
Last active Sep 21, 2020
Build a form with validation
View form_validation.dart
// TextFormField & Form Validation.
// https://flutter.dev/docs/cookbook/forms/validation
class FormValidation extends StatelessWidget {
@override
Widget build(BuildContext context) {
final appTitle = 'Form Validation Demo';
return MaterialApp(
title: appTitle,
home: Scaffold(