Skip to content

Instantly share code, notes, and snippets.

View brianegan's full-sized avatar

Brian Egan brianegan

View GitHub Profile
@brianegan
brianegan / computed_value_notifier.dart
Created November 16, 2018 13:38
ComputedValueNotifier concept
email,
@brianegan
brianegan / computed_value_notifier.dart
Created November 16, 2018 13:38
ComputedValueNotifier concept
import 'package:flutter/foundation.dart';
/// A class that can be used to derive a value based on data from another
/// Listenable or Listenables.
///
/// The value will be recomputed when the provided [listenable] notifies the
/// listeners that values have changed.
///
/// ### Simple Example
///
import 'package:flutter/foundation.dart';
/// A class that can be used to derive a value based on data from another
/// Listenable or Listenables.
///
/// The value will be recomputed when the provided [listenable] notifies the
/// listeners that values have changed.
///
/// ### Simple Example
///
@brianegan
brianegan / search_screen_test.dart
Created November 25, 2018 21:46
Search Screen Test using a Mock Bloc
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:github_search/github_api.dart';
import 'package:github_search/search_bloc.dart';
import 'package:github_search/search_empty_view.dart';
import 'package:github_search/search_error_view.dart';
import 'package:github_search/search_intro_view.dart';
import 'package:github_search/search_loading_view.dart';
import 'package:github_search/search_result_view.dart';
import 'package:github_search/search_screen.dart';
@brianegan
brianegan / main.dart
Created January 14, 2019 15:48
Changing tabs with a callback function
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
home: MyTabbedPage(),
@brianegan
brianegan / spinnies.dart
Created January 21, 2019 17:34
A pretty cool spinner for Flutter
import 'dart:math' show pi;
import 'package:flutter/material.dart';
class Spinnies extends StatefulWidget {
final Duration duration;
final Size size;
final double strokeWidth;
final List<SpinRect> rects;
@brianegan
brianegan / spinnies2.dart
Created January 21, 2019 17:43
Shows how to create some funky spinners
import 'dart:math' show pi;
import 'package:flutter/material.dart';
/// A Widget that can be configured to show funky spinning rectangles!
///
/// ### Usage
///
/// ```
/// Spinnies(
import 'dart:math' show pi;
import 'package:flutter/material.dart';
/// A Widget that can be configured to show funky spinning rectangles!
///
/// ### Usage
///
/// ```
/// Spinnies(
@brianegan
brianegan / main.dart
Created February 9, 2019 12:22
SetState example not rerendering after each statement
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
@brianegan
brianegan / stopwatch_widget_test.dart
Created February 21, 2019 11:57
Shows how to use a FakeStopwatch in a Widget test
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:quiver/async.dart';
import 'package:quiver/testing/time.dart';
void main() {
group('CounterTimer', () {
testWidgets('counts down from 10 to 0', (tester) async {