Created
February 15, 2019 20:32
-
-
Save HansMuller/8eff4b13792b313a70054777cb701132 to your computer and use it in GitHub Desktop.
This file contains hidden or 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'; | |
| class HomePage extends StatefulWidget { | |
| @override | |
| _HomePageState createState() => _HomePageState(); | |
| } | |
| class _HomePageState extends State<HomePage> { | |
| static const int _itemCount = 25; | |
| final List<TextEditingController> _controllers = List<TextEditingController>.generate(_itemCount, (int i) { | |
| return TextEditingController(text: 'Item $i'); | |
| }); | |
| @override | |
| Widget build(BuildContext context ) { | |
| final ThemeData theme = Theme.of(context); | |
| return Scaffold( | |
| extendBody: true, | |
| body: Builder( | |
| builder: (BuildContext context) { | |
| return ListView( | |
| padding: MediaQuery.of(context).padding, | |
| children: List<Widget>.generate(25, (int i) { | |
| final Color color = Colors.primaries[i % Colors.primaries.length]; | |
| return ListTile( | |
| title: TextField( | |
| controller: _controllers[i], | |
| decoration: InputDecoration( | |
| filled: true, | |
| fillColor: color.withOpacity(0.25), | |
| ), | |
| ), | |
| trailing: Icon( | |
| Icons.bookmark, | |
| color: color, | |
| ), | |
| ); | |
| }), | |
| ); | |
| }, | |
| ), | |
| bottomNavigationBar: BottomAppBar( | |
| color: Colors.white, | |
| shape: CircularNotchedRectangle(), | |
| child: Row( | |
| children: <Widget>[ | |
| FlatButton( | |
| onPressed: () { | |
| print('menu button'); | |
| }, | |
| child: Icon(Icons.menu), | |
| ), | |
| ], | |
| ), | |
| ), | |
| floatingActionButtonLocation: FloatingActionButtonLocation.endDocked, | |
| floatingActionButton: FloatingActionButton( | |
| backgroundColor: theme.colorScheme.primary.withOpacity(0.75), | |
| onPressed: () { | |
| print('FAB'); | |
| }, | |
| child: Icon(Icons.add), | |
| ), | |
| ); | |
| } | |
| } | |
| void main() { | |
| runApp(MaterialApp(home: HomePage())); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment