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 / three_counter_app_with_prints
Last active March 8, 2024 02:59
Two Screens with Three Counters and Print() functions highlight the StatefulWidgets' lifecycle
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
/// Highlights UI while debugging.
import 'package:flutter/rendering.dart' as debug;
void main() => runApp(MyApp());
///
class MyApp extends StatelessWidget {
@Andrious
Andrious / counter_app_with_prints.dart
Created March 1, 2024 02:11
The Counter App with a prints() functions highlighting the system & user events
//
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
@Andrious
Andrious / inheritedwidget_state_mixin.dart
Last active March 15, 2024 01:22
Providing a built-in InheritedWidget to a State class
//
// Any State object 'with' this mixin has then a built-in InheritedWidget
//
//
import 'package:flutter/material.dart';
/// Supplies an InheritedWidget to a State class
///
mixin InheritedWidgetStateMixin<T extends StatefulWidget> on State<T> {
@Andrious
Andrious / statex_counter_app.dart
Created September 28, 2023 15:35
Counter Example App using StateX v. 4.7
import 'package:flutter/material.dart';
import 'package:state_extended/state_extended.dart';
/// Pass the boolean true take make this humble example app more efficient.
void main() => runApp(const StateXCounterPage(useInherited: false));
class StateXCounterPage extends StatefulWidget {
const StateXCounterPage({
super.key,
@Andrious
Andrious / statex_readme_example_app.dart
Last active August 20, 2023 03:01
Counter App Example using the Pub.dev package, state_extended
//
import 'package:flutter/material.dart';
import 'package:state_extended/state_extended.dart';
void main() => runApp(const MyApp(key: Key('MyApp')));
/// README.md example app
class MyApp extends StatefulWidget {
///
@Andrious
Andrious / statex_counter_app.dart
Created June 30, 2023 20:47
Counter example app demonstrating the StateX class
import 'package:fluttery_framework/view.dart';
import 'package:fluttery_framework/controller.dart';
void main() => runApp(MyApp());
class MyApp extends AppStatefulWidget {
MyApp({Key? key}) : super(key: key);
@override
@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 / 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 / navigate_two_routes.dart
Last active January 6, 2021 01:51
Demonstration of Flutter's Naviagtion system
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(
title: 'Navigation Basics',
home: FirstRoute(),
));
class FirstRoute extends StatelessWidget {
@override
Widget build(BuildContext context) => Scaffold(