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 'dart:math' as math; | |
import 'package:flutter/foundation.dart'; | |
import 'package:flutter/rendering.dart'; | |
import 'package:flutter/widgets.dart'; | |
/// Signature for a function that creates a [TileSize] for a given index. | |
typedef TileSize IndexedTileSizeBuilder(int index); | |
/// Creates grid layouts with a fixed number of spans in the cross axis. |
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 'dart:math'; | |
import 'package:flutter/material.dart'; | |
import 'package:meta/meta.dart'; | |
void main() { | |
runApp(new AppContainer()); | |
} | |
class AppContextData { |
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
Widget build(BuildContext context) { | |
return new Scaffold( | |
appBar: new AppBar( | |
title: new Text(widget.title), | |
), | |
body: new Center( | |
child: new Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
new Text( |
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
Widget build(BuildContext context) => | |
Scaffold( | |
appBar: AppBar( | |
title: Text(widget.title), | |
), | |
body: Center( | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Text( |
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:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; | |
List<StaggeredTile> _staggeredTiles = const <StaggeredTile>[ | |
const StaggeredTile.count(2, 2), | |
const StaggeredTile.count(2, 1), | |
const StaggeredTile.count(1, 2), | |
const StaggeredTile.count(1, 1), | |
const StaggeredTile.count(2, 2), | |
const StaggeredTile.count(1, 2), |
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:flutter/rendering.dart'; | |
import 'package:flutter/widgets.dart'; | |
import 'package:flutter_sticky_header/flutter_sticky_header.dart'; | |
class _Page { | |
const _Page( | |
this.id, | |
this.title, | |
this.color, |
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
abstract class SlidableStackDelegate extends SlidableDelegate { | |
const SlidableStackDelegate({ | |
double fastThreshold, | |
}) : super(fastThreshold: fastThreshold); | |
@override | |
Widget buildActions(BuildContext context, SlidableDelegateContext ctx) { | |
final animation = new Tween( | |
begin: Offset.zero, | |
end: ctx.createOffset(ctx.state.totalActionsExtent * ctx.state.dragSign), |
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
Widget buildStackActions(BuildContext context, SlidableDelegateContext ctx) { | |
return new Positioned.fill( | |
child: new LayoutBuilder(builder: (context, constraints) { | |
final state = ctx.state; | |
final count = state.actionCount; | |
final bool showActions = ctx.showActions; | |
final Animation<double> actionsMoveAnimation = | |
state.actionsMoveAnimation; | |
final double actionExtent = | |
ctx.getMaxExtent(constraints) * state.widget.actionExtentRatio; |
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
final double actionExtent = | |
ctx.getMaxExtent(constraints) * state.widget.actionExtentRatio; |
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
final animations = Iterable.generate(count).map((index) { | |
return new Tween( | |
begin: -actionExtent, | |
end: (count - index - 1) * actionExtent, | |
).animate(actionsMoveAnimation); | |
}).toList(); |
OlderNewer