Skip to content

Commit 315a0ab

Browse files
Merge pull request #41 from undisputedcoder/temp
Template for card header and info
2 parents 3f61081 + 767ccf8 commit 315a0ab

File tree

6 files changed

+102
-86
lines changed

6 files changed

+102
-86
lines changed
File renamed without changes.

lib/Screens/home.dart

Lines changed: 11 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import 'package:apple/Alert/alert.dart';
22
import 'package:apple/Data/chart3.dart';
33
import 'package:apple/Data/chart1.dart';
4-
import 'package:apple/Data/info.dart';
4+
import 'package:apple/Data/definition.dart';
55
import 'package:apple/Screens/view1.dart';
66
import 'package:apple/Screens/view2.dart';
77
import 'package:apple/Screens/view3.dart';
88
import 'package:apple/Templates/card.dart';
9+
import 'package:apple/Templates/info.dart';
10+
import 'package:apple/Templates/title.dart';
911
import 'package:intl/intl.dart';
1012
import 'package:syncfusion_flutter_charts/charts.dart';
1113
import 'package:flutter/cupertino.dart';
@@ -14,7 +16,6 @@ import 'package:apple/Screens/profile.dart';
1416
import 'package:apple/Screens/setting.dart';
1517
import 'package:cloud_firestore/cloud_firestore.dart';
1618
import 'package:firebase_auth/firebase_auth.dart';
17-
import 'package:syncfusion_flutter_sliders/sliders.dart';
1819

1920
late User _currentUser;
2021

@@ -220,25 +221,7 @@ class _HomeState extends State<Home> {
220221
children: <Widget>[
221222
Card(
222223
child: Column(children: <Widget>[
223-
ListTile(
224-
leading: Text(
225-
"Target Overview",
226-
style: TextStyle(
227-
fontSize: 18,
228-
fontWeight: FontWeight.w600,
229-
),
230-
),
231-
trailing: CupertinoButton(
232-
child: Icon(CupertinoIcons.fullscreen),
233-
onPressed: () {
234-
Navigator.push(
235-
context,
236-
MaterialPageRoute(
237-
builder: (context) => View1())
238-
);
239-
},
240-
),
241-
),
224+
CardTitle("Target Overview", View1()),
242225
Divider(
243226
height: 1.0,
244227
color: CupertinoColors.systemGrey,
@@ -338,28 +321,7 @@ class _HomeState extends State<Home> {
338321
height: 5.0,
339322
color: CupertinoColors.systemGrey,
340323
),
341-
Row(
342-
children: [
343-
InkWell(
344-
onTap: () {
345-
showProdInfo(context);
346-
},
347-
child: Padding(
348-
padding: const EdgeInsets.fromLTRB(10, 5, 0, 0),
349-
child: info('Total Production ', _production)
350-
),
351-
),
352-
InkWell(
353-
onTap: () {
354-
showTenderInfo(context);
355-
},
356-
child: Padding(
357-
padding: const EdgeInsets.fromLTRB(10, 5, 0, 0),
358-
child: info('Total Tender ', _tender)
359-
),
360-
),
361-
],
362-
),
324+
Info(_production, _tender),
363325
Divider(
364326
height: 15.0,
365327
color: CupertinoColors.systemGrey,
@@ -406,25 +368,7 @@ class _HomeState extends State<Home> {
406368
),
407369
Card(
408370
child: Column(children: <Widget>[
409-
ListTile(
410-
leading: Text(
411-
"Target Overview",
412-
style: TextStyle(
413-
fontSize: 18,
414-
fontWeight: FontWeight.w600,
415-
),
416-
),
417-
trailing: CupertinoButton(
418-
child: Icon(CupertinoIcons.fullscreen),
419-
onPressed: () {
420-
Navigator.push(
421-
context,
422-
MaterialPageRoute(
423-
builder: (context) => View2())
424-
);
425-
},
426-
),
427-
),
371+
CardTitle("Target Overview", View2()),
428372
Divider(
429373
height: 1.0,
430374
color: CupertinoColors.systemGrey,
@@ -707,7 +651,7 @@ class _HomeState extends State<Home> {
707651
},
708652
child: Padding(
709653
padding: const EdgeInsets.fromLTRB(10, 5, 0, 0),
710-
child: info('Current Production & Presplit ', _production)
654+
child: defintion('Current Production & Presplit ', _production)
711655
),
712656
),
713657
Divider(
@@ -753,24 +697,7 @@ class _HomeState extends State<Home> {
753697
Card(
754698
child: Column(
755699
children: [
756-
ListTile(
757-
leading: Text(
758-
"Target Comparison",
759-
style: TextStyle(
760-
fontSize: 18,
761-
fontWeight: FontWeight.w600,
762-
),
763-
),
764-
trailing: CupertinoButton(
765-
onPressed: () {
766-
Navigator.push(
767-
context,
768-
MaterialPageRoute(
769-
builder: (context) => View3())
770-
);
771-
},
772-
child: Icon(CupertinoIcons.fullscreen)),
773-
),
700+
CardTitle("Target Comparison", View3()),
774701
Divider(
775702
height: 1.0,
776703
color: CupertinoColors.systemGrey,
@@ -885,7 +812,7 @@ class _HomeState extends State<Home> {
885812
},
886813
child: Padding(
887814
padding: const EdgeInsets.fromLTRB(10, 5, 0, 0),
888-
child: info('Total Presplit ', roundDouble(presplitTotal(_chartData1), 2))
815+
child: defintion('Total Presplit ', roundDouble(presplitTotal(_chartData1), 2))
889816
),
890817
),
891818
InkWell(
@@ -903,7 +830,7 @@ class _HomeState extends State<Home> {
903830
},
904831
child: Padding(
905832
padding: const EdgeInsets.fromLTRB(10, 5, 0, 0),
906-
child: info('Total Prod & Presplit ', roundDouble(total(_chartData1), 2))
833+
child: defintion('Total Prod & Presplit ', roundDouble(total(_chartData1), 2))
907834
),
908835
),
909836
InkWell(
@@ -912,7 +839,7 @@ class _HomeState extends State<Home> {
912839
},
913840
child: Padding(
914841
padding: const EdgeInsets.fromLTRB(10, 5, 5, 0),
915-
child: info('Total Tender ', roundDouble(tenTotal(_chartData1), 2))
842+
child: defintion('Total Tender ', roundDouble(tenTotal(_chartData1), 2))
916843
),
917844
),
918845
],

lib/Screens/view1.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import 'package:apple/Data/chart1.dart';
2-
import 'package:apple/Data/info.dart';
2+
import 'package:apple/Data/definition.dart';
33
import 'package:apple/Templates/card.dart';
44
import 'package:flutter/cupertino.dart';
55
import 'package:flutter/material.dart';

lib/Templates/card.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'package:flutter/cupertino.dart';
22
import 'package:flutter/material.dart';
33

4-
Widget info(String title, double val) {
4+
Widget defintion(String title, double val) {
55
return Column(
66
children: [
77
Align(

lib/Templates/info.dart

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import 'package:apple/Data/definition.dart';
2+
import 'package:flutter/cupertino.dart';
3+
import 'package:flutter/material.dart';
4+
5+
import 'card.dart';
6+
7+
class Info extends StatelessWidget {
8+
var _production;
9+
var _tender;
10+
11+
Info(this._production, this._tender);
12+
13+
@override
14+
Widget build(BuildContext context) {
15+
return Row(
16+
children: [
17+
InkWell(
18+
onTap: () {
19+
showProdInfo(context);
20+
},
21+
child: Padding(
22+
padding: const EdgeInsets.fromLTRB(10, 5, 0, 0),
23+
child: defintion('Total Production ', _production)
24+
),
25+
),
26+
InkWell(
27+
onTap: () {
28+
showTenderInfo(context);
29+
},
30+
child: Padding(
31+
padding: const EdgeInsets.fromLTRB(10, 5, 0, 0),
32+
child: defintion('Total Tender ', _tender)
33+
),
34+
),
35+
],
36+
);
37+
}
38+
}

lib/Templates/title.dart

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import 'package:flutter/cupertino.dart';
2+
import 'package:flutter/material.dart';
3+
4+
/*
5+
class Title extends StatefulWidget {
6+
String title = '';
7+
8+
Title(this.title);
9+
10+
@override
11+
_TitleState createState() => _TitleState();
12+
}
13+
14+
class _TitleState extends State<Title> {
15+
16+
@override
17+
Widget build(BuildContext context) {
18+
return Container();
19+
}
20+
}*/
21+
22+
class CardTitle extends StatelessWidget {
23+
String title = '';
24+
var fullscreen;
25+
26+
CardTitle(this.title, this.fullscreen);
27+
28+
@override
29+
Widget build(BuildContext context) {
30+
return ListTile(
31+
leading: Text(
32+
title,
33+
style: TextStyle(
34+
fontSize: 18,
35+
fontWeight: FontWeight.w600,
36+
),
37+
),
38+
trailing: CupertinoButton(
39+
child: Icon(CupertinoIcons.fullscreen),
40+
onPressed: () {
41+
Navigator.push(
42+
context,
43+
MaterialPageRoute(
44+
builder: (context) => fullscreen)
45+
);
46+
},
47+
),
48+
);
49+
}
50+
}
51+

0 commit comments

Comments
 (0)