@@ -35,29 +35,26 @@ class _UssdRootState extends State<UssdRootWidget> {
3535 Widget build (BuildContext context) {
3636 if (items != null )
3737 return ListView .builder (
38- itemCount: items.length + 1 ,
39- itemBuilder: (context, index) {
40- if (index == 0 )
41- return Container (
42- height: 100 ,
43- color: Colors .blue,
44- child: Center (
45- child:
46- Icon (Icons .developer_mode, size: 64 , color: Colors .white),
47- ),
48- );
38+ itemCount: items.length,
39+ itemBuilder: (context, index) {
40+ var item = items[index];
4941
50- var item = items[index - 1 ];
51-
52- if (item.type == 'code' )
53- return UssdWidget (
42+ if ( item.type == 'code' )
43+ return Padding (
44+ padding : EdgeInsets . only (left : 14.0 , right : 14.0 ),
45+ child : UssdWidget (
5446 ussdCode: item,
55- );
56- else
57- return UssdCategoryWidget (
47+ ),
48+ );
49+ else
50+ return Padding (
51+ padding: EdgeInsets .only (left: 14.0 , right: 14.0 ),
52+ child: UssdCategoryWidget (
5853 category: item,
59- );
60- });
54+ ),
55+ );
56+ },
57+ );
6158
6259 return Center (
6360 child: CircularProgressIndicator (),
@@ -87,7 +84,9 @@ class UssdCategoryWidget extends StatelessWidget {
8784 child: Column (children: < Widget > [
8885 ListTile (
8986 leading: Icon (category.icon, color: Colors .blue),
90- title: Text (category.name.toUpperCase ()),
87+ title: Text (
88+ category.name.toUpperCase (),
89+ ),
9190 ),
9291 Divider (
9392 color: Colors .blue,
@@ -108,32 +107,59 @@ class UssdWidgets extends StatelessWidget {
108107 Widget build (BuildContext context) {
109108 return Scaffold (
110109 appBar: AppBar (
111- elevation: 0 ,
112- title: Text (title),
110+ centerTitle: true ,
111+ title: Text (
112+ title,
113+ style: TextStyle (
114+ fontWeight: FontWeight .bold,
115+ ),
116+ ),
117+ leading: IconButton (
118+ icon: Icon (Icons .arrow_back_ios),
119+ onPressed: () {
120+ Navigator .of (context).pop ();
121+ },
122+ ),
113123 ),
114- body: Container (
115- height: MediaQuery .of (context).size.height,
116- child: ListView .builder (
117- itemCount: ussdItems.length + 1 ,
118- itemBuilder: (context, index) {
119- if (index == 0 )
120- return Container (
121- height: 100 ,
122- color: Colors .blue,
123- child: Icon (icon, size: 64 , color: Colors .white),
124- );
125-
126- var item = ussdItems[index - 1 ];
127-
128- if (item.type == 'code' )
129- return UssdWidget (
130- ussdCode: item,
131- );
132- else
133- return UssdCategoryWidget (
134- category: item,
135- );
136- }),
124+ body: ListView (
125+ children: < Widget > [
126+ Container (
127+ height: 100 ,
128+ color: Colors .blue,
129+ child: Icon (icon, size: 64 , color: Colors .white),
130+ ),
131+ Container (
132+ decoration: BoxDecoration (
133+ color: Colors .white,
134+ borderRadius: BorderRadius .only (
135+ topLeft: Radius .circular (45.0 ),
136+ bottomRight: Radius .circular (45.0 ),
137+ ),
138+ ),
139+ height: MediaQuery .of (context).size.height - 180 ,
140+ child: ListView .builder (
141+ itemCount: ussdItems.length,
142+ itemBuilder: (context, index) {
143+ var item = ussdItems[index];
144+
145+ if (item.type == 'code' )
146+ return Padding (
147+ padding: EdgeInsets .only (left: 14.0 , right: 14.0 ),
148+ child: UssdWidget (
149+ ussdCode: item,
150+ ),
151+ );
152+ else
153+ return Padding (
154+ padding: EdgeInsets .only (left: 14.0 , right: 14.0 ),
155+ child: UssdCategoryWidget (
156+ category: item,
157+ ),
158+ );
159+ },
160+ ),
161+ ),
162+ ],
137163 ),
138164 );
139165 }
@@ -174,7 +200,9 @@ class SimpleCode extends StatelessWidget {
174200 child: Column (children: < Widget > [
175201 ListTile (
176202 leading: Icon (icon, color: Colors .blue),
177- title: Text (name.toUpperCase ()),
203+ title: Text (
204+ name.toUpperCase (),
205+ ),
178206 ),
179207 Divider (
180208 color: Colors .blue,
@@ -224,23 +252,46 @@ class CodeFormPage extends StatelessWidget {
224252 Widget build (BuildContext context) {
225253 return Scaffold (
226254 appBar: AppBar (
227- elevation: 0 ,
228- title: Text (code.name.toUpperCase ()),
255+ centerTitle: true ,
256+ title: Text (
257+ code.name.toUpperCase (),
258+ style: TextStyle (
259+ fontWeight: FontWeight .bold,
260+ ),
261+ ),
262+ leading: IconButton (
263+ onPressed: () {
264+ Navigator .of (context).pop ();
265+ },
266+ icon: Icon (Icons .arrow_back_ios),
267+ ),
229268 ),
230- body: Container (
231- alignment: Alignment .center,
232- child: Center (
233- child: Padding (
269+ body: ListView (
270+ children: < Widget > [
271+ Container (
272+ height: MediaQuery .of (context).size.height - 80 ,
273+ decoration: BoxDecoration (
274+ color: Colors .white,
275+ borderRadius: BorderRadius .only (
276+ topLeft: Radius .circular (45.0 ),
277+ bottomRight: Radius .circular (45.0 ),
278+ ),
279+ ),
280+ child: Center (
281+ child: Padding (
234282 padding: EdgeInsets .all (10.0 ),
235- child: Card (
236- child: Padding (
237- padding: EdgeInsets .all (20.0 ),
238- child: CodeForm (
239- code: code.code,
240- fields: code.fields,
241- type: code.type,
242- )),
243- ))),
283+ child: Padding (
284+ padding: EdgeInsets .all (20.0 ),
285+ child: CodeForm (
286+ code: code.code,
287+ fields: code.fields,
288+ type: code.type,
289+ ),
290+ ),
291+ ),
292+ ),
293+ )
294+ ],
244295 ),
245296 );
246297 }
@@ -283,6 +334,7 @@ class _CodeFormState extends State<CodeForm> {
283334 return Padding (
284335 padding: EdgeInsets .all (10.0 ),
285336 child: MaterialButton (
337+ elevation: 0.5 ,
286338 color: Colors .blue,
287339 minWidth: MediaQuery .of (context).size.width,
288340 child: Text (
0 commit comments