Skip to content

Instantly share code, notes, and snippets.

@ijoschek
Last active December 5, 2018 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ijoschek/f11efe24fa6039095c0f1e487eb6b86e to your computer and use it in GitHub Desktop.
Save ijoschek/f11efe24fa6039095c0f1e487eb6b86e to your computer and use it in GitHub Desktop.
flutter_firestore_tut
//...
class _Home extends State<StatefulWidget> {
//...
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Flutter Firestore Tutorial'),
),
body: Padding(
padding: const EdgeInsets.all(18.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Center(child: Text('Total Interactions: $_interactionCount')),
Row(
children: <Widget>[
Expanded(
child: TextField(
controller: _myContr,
decoration: InputDecoration(
border: InputBorder.none, hintText: 'Enter Text'),
),
),
RaisedButton(
color: Colors.cyan,
textColor: Colors.white,
splashColor: Colors.cyanAccent,
child: const Text('Write to Firestore'),
onPressed: clickWrite,
),
],
),
Divider(),
Center(
child:
Text('Get Number of Docs with specific Text: $_queriedDocs'),
),
Row(
children: <Widget>[
Expanded(
child: TextField(
controller: _getContr,
decoration: InputDecoration(
border: InputBorder.none, hintText: 'Enter Text'),
),
),
RaisedButton(
color: Colors.amber,
textColor: Colors.white,
splashColor: Colors.amberAccent,
child: const Text('Get'),
onPressed: clickGet,
),
],
),
Divider(),
Center(child: Text('Documents in Store: $_totalDocs')),
Row(
children: <Widget>[
Expanded(child: Text('Turn on Listener')),
Switch(
value: _switchOnOff,
onChanged: (val) {
switchListener(val);
}),
],
),
Divider(),
//...
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment