View ChangeNotifier.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef VoidCallback = void Function(); | |
class ChangeNotifier { | |
List<VoidCallback> _listeners = List<VoidCallback>(); | |
List<int> _toRemove = List<int>(); | |
bool _notifying = false; | |
bool get hasListeners { | |
return _listeners.isNotEmpty; | |
} |
View ChangeNotifier.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef VoidCallback = void Function(); | |
class _Listener { | |
_Listener(this.func); | |
final VoidCallback func; | |
VoidCallback afterNotify; | |
void call() { | |
if (afterNotify == null) { | |
func(); | |
} |
View render_sliver_gap.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RenderSliverGap extends RenderSliver { | |
RenderSliverGap({ | |
double mainAxisExtent, | |
}) : _mainAxisExtent = mainAxisExtent; | |
double get mainAxisExtent => _mainAxisExtent; | |
double _mainAxisExtent; | |
set mainAxisExtent(double value) { | |
if (_mainAxisExtent != value) { | |
_mainAxisExtent = value; |
View sliver_geometry.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SliverGeometry({ | |
this.scrollExtent = 0.0, | |
this.paintExtent = 0.0, | |
this.paintOrigin = 0.0, | |
double layoutExtent, | |
this.maxPaintExtent = 0.0, | |
this.maxScrollObstructionExtent = 0.0, | |
double hitTestExtent, | |
bool visible, | |
this.hasVisualOverflow = false, |
View sliver_constraints.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SliverConstraints({ | |
@required this.axisDirection, | |
@required this.growthDirection, | |
@required this.userScrollDirection, | |
@required this.scrollOffset, | |
@required this.precedingScrollExtent, | |
@required this.overlap, | |
@required this.remainingPaintExtent, | |
@required this.crossAxisExtent, | |
@required this.crossAxisDirection, |
View gap.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Gap extends LeafRenderObjectWidget { | |
const Gap( | |
this.mainAxisExtent, { | |
Key key, | |
}) : assert(mainAxisExtent != null && | |
mainAxisExtent >= 0 && | |
mainAxisExtent < double.infinity), | |
super(key: key); | |
final double mainAxisExtent; |
View render_gap.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class _RenderGap extends RenderBox { | |
_RenderGap({ | |
double mainAxisExtent, | |
}) : _mainAxisExtent = mainAxisExtent; | |
double get mainAxisExtent => _mainAxisExtent; | |
double _mainAxisExtent; | |
set mainAxisExtent(double value) { | |
if (_mainAxisExtent != value) { | |
_mainAxisExtent = value; |
View gap_01.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Gap extends LeafRenderObjectWidget { | |
const Gap( | |
this.mainAxisExtent, { | |
Key key, | |
}) : assert(mainAxisExtent != null && | |
mainAxisExtent >= 0 && | |
mainAxisExtent < double.infinity), | |
super(key: key); | |
final double mainAxisExtent; |
View changenotifierprovider_example.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:provider/provider.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return ChangeNotifierProvider( | |
builder: (_) => ValueNotifier<String>(null), |
View model_binding_demo.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
ModelBinding<T>: a simple class for binding a Flutter app to a immutable | |
model of type T. | |
This is a complete application. The app shows the state of an instance of | |
MyModel in a button's label, and replaces its MyModel instance when the | |
button is pressed. | |
ModelBinding is an inherited widget that must be created in a context above |
NewerOlder