1+ import 'package:cf_view/ui/home.dart' ;
12import 'package:flutter/material.dart' ;
23import 'dart:async' ;
34import 'dart:convert' ;
@@ -12,6 +13,47 @@ class Compare extends StatelessWidget {
1213 this .handle2 = handle2;
1314 }
1415
16+ TextEditingController _handle1Controller = TextEditingController ();
17+ TextEditingController _handle2Controller = TextEditingController ();
18+
19+ _displayCompareDialog (BuildContext context) async {
20+ return showDialog (
21+ context: context,
22+ builder: (context) {
23+ return AlertDialog (
24+ title: new Column (
25+ children: < Widget > [
26+ new TextField (
27+ controller: _handle1Controller,
28+ decoration: InputDecoration (hintText: "Handle1" ),
29+ ),
30+ new TextField (
31+ controller: _handle2Controller,
32+ decoration: InputDecoration (hintText: "Handle2" ),
33+ ),
34+ ],
35+ ),
36+ actions: < Widget > [
37+ new FlatButton (
38+ child: new Text ('Compare' ),
39+ onPressed: () {
40+ Navigator .of (context).pop (context);
41+ Navigator .push (context, MaterialPageRoute (
42+ builder: (context) {
43+ String handle1 = _handle1Controller.text.toString ();
44+ String handle2 = _handle2Controller.text.toString ();
45+ _handle1Controller.clear ();
46+ _handle2Controller.clear ();
47+ return Compare (handle1, handle2);
48+ },
49+ ));
50+ },
51+ ),
52+ ],
53+ );
54+ });
55+ }
56+
1557 @override
1658 Widget build (BuildContext context) {
1759 // TODO: implement build
@@ -49,13 +91,34 @@ class Compare extends StatelessWidget {
4991 ],
5092 ),
5193 floatingActionButton: FloatingActionButton (
52- backgroundColor: Colors .deepPurple,
53- child: Icon (
54- Icons .arrow_back_ios,
94+ backgroundColor: Colors .deepPurple,
95+ child: Icon (
96+ Icons .compare,
97+ ),
98+ onPressed: () => _displayCompareDialog (context)),
99+ bottomNavigationBar: Container (
100+ height: 60 ,
101+ color: Colors .black12,
102+ child: InkWell (
103+ onTap: () {
104+ Navigator .push (
105+ context,
106+ MaterialPageRoute (builder: (context) => Home ()),
107+ );
108+ },
109+ child: Padding (
110+ padding: EdgeInsets .only (top: 8.0 ),
111+ child: Column (
112+ children: < Widget > [
113+ Icon (
114+ Icons .home,
115+ color: Theme .of (context).accentColor,
116+ ),
117+ Text ('Home' )
118+ ],
119+ ),
120+ ),
55121 ),
56- onPressed: () {
57- Navigator .pop (context);
58- },
59122 ),
60123 );
61124 }
0 commit comments