Skip to content

Commit 53d59f1

Browse files
committed
Add edit expense item screen
1 parent f54b9da commit 53d59f1

File tree

5 files changed

+512
-11
lines changed

5 files changed

+512
-11
lines changed
Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
import 'package:basic/Enums/button_size_enums.dart';
2+
import 'package:basic/classes/spacing_class.dart';
3+
import 'package:basic/constants/color_constants.dart';
4+
import 'package:basic/constants/textstyle_constants.dart';
5+
import 'package:basic/screens/edit/edit_service1_screen.dart';
6+
import 'package:basic/screens/edit/edit_service_screen.dart';
7+
import 'package:basic/screens/new/new_item_screen.dart';
8+
import 'package:basic/screens/upload/upload_item_screen.dart';
9+
import 'package:basic/screens/upload/upload_product_screen.dart';
10+
import 'package:basic/widgets/appbar_button_widget.dart';
11+
import 'package:basic/widgets/button_widget.dart';
12+
import 'package:flutter/material.dart';
13+
import 'package:flutter/services.dart';
14+
15+
class EditExpenseItemScreen extends StatelessWidget {
16+
const EditExpenseItemScreen({Key? key}) : super(key: key);
17+
18+
@override
19+
Widget build(BuildContext context) {
20+
SystemChrome.setEnabledSystemUIOverlays([
21+
SystemUiOverlay.top,
22+
SystemUiOverlay.bottom,
23+
]);
24+
25+
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
26+
statusBarColor: primaryColor,
27+
statusBarBrightness: Brightness.dark,
28+
systemNavigationBarIconBrightness: Brightness.dark,
29+
statusBarIconBrightness: Brightness.light,
30+
systemNavigationBarColor: desaturatedGreyColor,
31+
));
32+
33+
return Scaffold(
34+
appBar: AppBar(
35+
brightness: Brightness.dark,
36+
backgroundColor: primaryColor,
37+
title: Row(
38+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
39+
children: [
40+
AppBarButtonWidget(
41+
icon: Icon(
42+
Icons.arrow_back_ios,
43+
size: 17,
44+
),
45+
isIconSameSize: false,
46+
onTap: () {
47+
Navigator.of(context).pop();
48+
},
49+
size: ButtonSize.small,
50+
text: 'Return',
51+
),
52+
AppBarButtonWidget(
53+
icon: Image.asset('images/edit_icon.png'),
54+
isIconSameSize: true,
55+
onTap: () {
56+
Navigator.of(context)
57+
.push(MaterialPageRoute(builder: (BuildContext ctx) {
58+
return UploadItemScreen();
59+
}));
60+
},
61+
size: ButtonSize.small,
62+
text: 'Edit',
63+
),
64+
],
65+
),
66+
automaticallyImplyLeading: false,
67+
bottom: PreferredSize(
68+
child: Container(
69+
margin: EdgeInsets.only(
70+
left: 20,
71+
bottom: 20,
72+
),
73+
child: Align(
74+
alignment: Alignment.topLeft,
75+
child: Text(
76+
'Crepes au chocolat',
77+
style: h6TextStyle.merge(TextStyle(color: whiteColor)),
78+
),
79+
),
80+
),
81+
preferredSize: Size.fromHeight(60),
82+
),
83+
),
84+
body: SingleChildScrollView(
85+
child: Container(
86+
padding: EdgeInsets.all(20),
87+
child: Column(
88+
children: [
89+
Container(
90+
width: double.infinity,
91+
padding: EdgeInsets.symmetric(
92+
vertical: 20,
93+
horizontal: 20,
94+
),
95+
decoration: BoxDecoration(
96+
color: whiteColor,
97+
borderRadius: BorderRadius.all(Radius.circular(20)),
98+
),
99+
child: Text(
100+
'Product',
101+
style: bodyTextStyle,
102+
),
103+
),
104+
SizedBox(height: 10),
105+
Row(
106+
children: [
107+
Radio(
108+
value: 1,
109+
groupValue: 1,
110+
onChanged: (int? t) {},
111+
),
112+
Text(
113+
'Automatically add to products in stock',
114+
style: labelBoldTextStyle,
115+
),
116+
],
117+
),
118+
Container(
119+
width: double.infinity,
120+
padding: EdgeInsets.symmetric(
121+
vertical: 20,
122+
horizontal: 20,
123+
),
124+
decoration: BoxDecoration(
125+
color: whiteColor,
126+
borderRadius: BorderRadius.all(Radius.circular(20)),
127+
),
128+
child: Text(
129+
'Crepes au chocolat',
130+
style: bodyTextStyle,
131+
),
132+
),
133+
SizedBox(height: 10),
134+
Row(
135+
children: [
136+
Expanded(
137+
child: Container(
138+
decoration: BoxDecoration(
139+
color: whiteColor,
140+
borderRadius: BorderRadius.all(Radius.circular(20)),
141+
),
142+
padding: EdgeInsets.symmetric(
143+
vertical: 20,
144+
horizontal: 20,
145+
),
146+
child: Text(
147+
'XAF1,000',
148+
style: bodyTextStyle,
149+
),
150+
),
151+
),
152+
SpacingClass.hrMedium,
153+
Container(
154+
decoration: BoxDecoration(
155+
color: whiteColor,
156+
borderRadius: BorderRadius.all(Radius.circular(20)),
157+
),
158+
padding: EdgeInsets.symmetric(
159+
vertical: 20,
160+
horizontal: 20,
161+
),
162+
child: Text(
163+
'20',
164+
style: bodyTextStyle,
165+
),
166+
),
167+
],
168+
),
169+
SizedBox(height: 10),
170+
Container(
171+
width: double.infinity,
172+
padding: EdgeInsets.symmetric(
173+
vertical: 20,
174+
horizontal: 20,
175+
),
176+
decoration: BoxDecoration(
177+
color: whiteColor,
178+
borderRadius: BorderRadius.all(Radius.circular(20)),
179+
),
180+
child: Text(
181+
'XAF2,000',
182+
style: bodyTextStyle,
183+
),
184+
),
185+
SizedBox(height: 10),
186+
Container(
187+
width: double.infinity,
188+
decoration: BoxDecoration(
189+
color: whiteColor,
190+
borderRadius: BorderRadius.all(Radius.circular(20)),
191+
),
192+
padding: EdgeInsets.symmetric(
193+
vertical: 20,
194+
horizontal: 20,
195+
),
196+
child: Text(
197+
'Description',
198+
style: bodyTextStyle.merge(TextStyle(color: lightGreyColor)),
199+
),
200+
),
201+
],
202+
),
203+
),
204+
),
205+
persistentFooterButtons: [
206+
Container(
207+
padding: EdgeInsets.all(10),
208+
color: desaturatedGreyColor,
209+
child: ButtonWidget(
210+
backgroundColor: lightRedColor!,
211+
loading: false,
212+
onTap: () {
213+
Navigator.of(context)
214+
.push(MaterialPageRoute(builder: (BuildContext ctx) {
215+
return EditService1Screen();
216+
}));
217+
},
218+
size: ButtonSize.big,
219+
text: 'Delete product',
220+
textColor: redColor!,
221+
)),
222+
],
223+
);
224+
}
225+
}

lib/screens/new/new_expense_product_screen.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:basic/constants/color_constants.dart';
22
import 'package:basic/constants/textstyle_constants.dart';
3+
import 'package:basic/screens/new/new_expense_service_screen.dart';
34
import 'package:basic/screens/new/new_service_screen.dart';
45
import 'package:basic/widgets/row_price_details_widget.dart';
56
import 'package:flutter/material.dart';
@@ -353,7 +354,7 @@ class NewExpenseProductScreen extends StatelessWidget {
353354
onTap: () {
354355
Navigator.of(context)
355356
.push(MaterialPageRoute(builder: (BuildContext ctx) {
356-
return NewServiceScreen();
357+
return NewExpenseServiceScreen();
357358
}));
358359
},
359360
child: Container(

lib/screens/purchases/purchases_body.dart

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:basic/constants/color_constants.dart';
22
import 'package:basic/constants/textstyle_constants.dart';
33
import 'package:basic/screens/edit/edit_customer_screen.dart';
4+
import 'package:basic/screens/edit/edit_expense_item_screen.dart';
45
import 'package:basic/screens/edit/edit_expense_screen.dart';
56
import 'package:basic/screens/edit/edit_item_screen.dart';
67
import 'package:basic/screens/edit/edit_product_screen.dart';
@@ -182,7 +183,7 @@ Column genListItems() {
182183
onTap: () {
183184
Navigator.of(context)
184185
.push(MaterialPageRoute(builder: (BuildContext ctx) {
185-
return EditItemScreen();
186+
return EditExpenseItemScreen();
186187
}));
187188
},
188189
child: Container(
@@ -211,13 +212,6 @@ Column genListItems() {
211212
],
212213
),
213214
),
214-
Expanded(
215-
child: Text(
216-
'20 in stock',
217-
style: captionBoldTextStyle,
218-
textAlign: TextAlign.right,
219-
),
220-
),
221215
],
222216
),
223217
),

lib/screens/purchases/purchases_screen.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:basic/constants/color_constants.dart';
22
import 'package:basic/constants/textstyle_constants.dart';
33
import 'package:basic/screens/new/new_customer_screen.dart';
4+
import 'package:basic/screens/new/new_expense_product_screen.dart';
45
import 'package:basic/screens/new/new_item_screen.dart';
56
import 'package:basic/screens/new/new_product_screen.dart';
67
import 'package:basic/screens/purchases/purchases_body.dart';
@@ -124,9 +125,9 @@ class _PurchasesScreenState extends State<PurchasesScreen>
124125
body: purchasesBody(_tabController!),
125126
floatingActionButton: FloatingActionButton(
126127
onPressed: () {
127-
Navigator.of(context)
128+
Navigator.of(context)
128129
.push(MaterialPageRoute(builder: (BuildContext ctx) {
129-
if (_index == 0) return NewProductScreen();
130+
if (_index == 0) return NewExpenseProductScreen();
130131
if (_index == 1) return NewItemScreen();
131132
return NewCustomerScreen();
132133
}));

0 commit comments

Comments
 (0)