gas refill

main_design2.0
nextwo 2 years ago
parent ec4d4a9193
commit 64b249a0cd

@ -18,6 +18,8 @@
"transferRequest" : "طلب نقل",
"serviceRequest" : "طلب خدمة",
"newServiceRequest" : "طلب خدمة جديدة",
"search": "بحث",
"filter" : "تصنيف",
"newGasRefillRequest" : "طلب إعادة تعبئة غاز جديد",
"newTransferRequest" : "طلب نقل جديد",
"submitRequest" : "تأكيد الطلب",

@ -18,6 +18,8 @@
"transferRequest" : "Transfer Request",
"serviceRequest" : "Service Request",
"newServiceRequest" : "New Service Request",
"search": "Search",
"filter": "Filter",
"newGasRefillRequest" : "New Gas Refill Request",
"newTransferRequest" : "New Transfer Request",
"submitRequest" : "Submit Request",

@ -18,6 +18,8 @@ enum TranslationKeys {
transferRequest,
serviceRequest,
newServiceRequest,
search,
filter,
newGasRefillRequest,
newTransferRequest,
submitRequest,

@ -0,0 +1,36 @@
import 'package:flutter/material.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import '../../models/enums/translation_keys.dart';
class AppSearchField extends StatefulWidget {
final Function(String) onChanged;
final Function(String) onSubmitted;
const AppSearchField({Key key, this.onChanged, this.onSubmitted}) : super(key: key);
@override
State<AppSearchField> createState() => _AppSearchFieldState();
}
class _AppSearchFieldState extends State<AppSearchField> {
@override
Widget build(BuildContext context) {
return TextField(
onChanged: widget.onChanged,
onSubmitted: widget.onSubmitted,
decoration: InputDecoration(
prefixIcon: const Icon(Icons.search, color: AppColor.neutral20,),
hintText: context.translate(TranslationKeys.search),
hintStyle: TextStyle(
fontSize: Theme.of(context).textTheme.bodySmall.fontSize
),
filled: true,
fillColor: AppColor.neutral30,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(15),
borderSide: BorderSide.none,
)),
);
}
}

@ -0,0 +1,23 @@
import 'package:flutter/material.dart';
class AppTabBar extends StatelessWidget {
const AppTabBar({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return TabBar(
tabs:[
Tab(
icon: Icon(Icons.cloud_outlined),
),
Tab(
icon: Icon(Icons.beach_access_sharp),
),
Tab(
icon: Icon(Icons.brightness_5_sharp),
),
],
);
}
}

@ -5,7 +5,7 @@ import 'package:flutter/services.dart';
import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/new_views/pages/land_page/home_app_bar.dart';
import 'package:test_sa/new_views/pages/land_page/my_assets_page.dart';
import 'package:test_sa/new_views/pages/land_page/my_requests_page.dart';
import 'package:test_sa/new_views/pages/land_page/my_request/my_requests_page.dart';
import '../../common_widgets/app_bottom_nav_bar.dart';
import '../../common_widgets/app_drawer.dart';
@ -24,6 +24,7 @@ class LandPage extends StatefulWidget {
class _LandPageState extends State<LandPage> {
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
int currentPageIndex = 0;
bool showAppbar =true;
final List<Widget> _pages = const <Widget>[
DashboardPage(),
MyRequestsPage(),
@ -53,11 +54,8 @@ class _LandPageState extends State<LandPage> {
},
child: Scaffold(
key: _scaffoldKey,
appBar: HomeAppBar(scaffoldKey: _scaffoldKey),
body: Padding(
padding: EdgeInsetsDirectional.only(start: 16.toScreenWidth, end: 11.toScreenHeight),
child: _pages[currentPageIndex],
),
appBar: showAppbar?HomeAppBar(scaffoldKey: _scaffoldKey): null,
body: _pages[currentPageIndex],
drawer: const AppDrawer(),
floatingActionButton: const AppFloatingActionButton(),
bottomNavigationBar: AppBottomNavigationBar(
@ -74,6 +72,16 @@ class _LandPageState extends State<LandPage> {
setState(() {
currentPageIndex = index;
});
if(index == 1){
setState(() {
showAppbar =false;
});
}else{
setState(() {
showAppbar =true;
});
}
}
},
),

@ -0,0 +1,52 @@
import 'package:flutter/material.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/models/enums/translation_keys.dart';
import '../../../app_style/app_color.dart';
import '../../../common_widgets/app_search_field.dart';
class MyRequestsPage extends StatelessWidget {
const MyRequestsPage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leadingWidth: 0,
title: Padding(
padding: const EdgeInsets.only(bottom: 10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(child: SizedBox(
height: 50,
child: AppSearchField())),
SizedBox(width: 20,),
Text(context.translate(TranslationKeys.filter), style: TextStyle(
color: AppColor.primary50,
fontSize: Theme.of(context).textTheme.bodySmall.fontSize,
fontWeight: FontWeight.w500
),)
],
),
),
),
body: TabBarView(
children: const <Widget>[
Center(
child: Text("It's cloudy here"),
),
Center(
child: Text("It's rainy here"),
),
Center(
child: Text("It's sunny here"),
),
],
),
);
}
}

@ -1,14 +0,0 @@
import 'package:flutter/material.dart';
class MyRequestsPage extends StatelessWidget {
const MyRequestsPage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const Scaffold(
body: Center(
child: Text("My Requests"),
),
);
}
}

@ -4,12 +4,16 @@ import 'package:test_sa/controllers/localization/localization.dart';
import 'package:test_sa/controllers/providers/api/gas_refill_provider.dart';
import 'package:test_sa/controllers/providers/api/user_provider.dart';
import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/models/subtitle.dart';
import 'package:test_sa/views/app_style/colors.dart';
import 'package:test_sa/views/widgets/buttons/app_back_button.dart';
import 'package:test_sa/views/widgets/gas_refill/gas_refill_list.dart';
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
import '../../../../models/enums/translation_keys.dart';
import '../../../../new_views/app_style/app_color.dart';
import '../../../../new_views/common_widgets/app_search_field.dart';
import '../../../widgets/switch_button.dart';
class TrackGasRefillPage extends StatefulWidget {
@ -31,13 +35,13 @@ class _TrackGasRefillPageState extends State<TrackGasRefillPage> with TickerProv
Widget build(BuildContext context) {
if (_gasRefillProvider == null) {
_gasRefillProvider = Provider.of<GasRefillProvider>(context);
//_gasRefillProvider?.isLoading = false;
_gasRefillProvider.reset();
}
_userProvider = Provider.of<UserProvider>(context);
_settingProvider = Provider.of<SettingProvider>(context);
return Scaffold(
body: SafeArea(
child: LoadingManager(
isLoading: _gasRefillProvider.isLoading,
@ -56,45 +60,64 @@ class _TrackGasRefillPageState extends State<TrackGasRefillPage> with TickerProv
Column(
children: [
Container(
color: AColors.white,
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 4),
child: Column(
children: [
Row(
color: Colors.white,
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 15),
//margin: const EdgeInsets.all(10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const ABackButton(),
Expanded(
child: Center(
child: Text(
"Gas Refill Requests",
style: Theme.of(context).textTheme.headline6.copyWith(color: AColors.grey3A, fontStyle: FontStyle.italic),
),
),
),
const SizedBox(
width: 48,
)
],
),
Expanded(child: SizedBox(
height: 40,
child: AppSearchField())),
SizedBox(width: 20,),
Text(context.translate(TranslationKeys.filter), style: TextStyle(
color: AppColor.primary50,
fontSize: Theme.of(context).textTheme.bodySmall.fontSize,
fontWeight: FontWeight.w500
),)
],
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: ASwitchButton(
title: "Most Recent",
value: mostRecent,
onChange: (value) async {
mostRecent = value;
_gasRefillProvider.reset();
await _gasRefillProvider.getRequests(
user: _userProvider.user,
host: _settingProvider.host,
mostRecent: mostRecent,
);
},
),
),
// Container(
// color: AColors.white,
// padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 4),
// child: Column(
// children: [
// Row(
// children: [
// const ABackButton(),
// Expanded(
// child: Center(
// child: Text(
// "Gas Refill Requests",
// style: Theme.of(context).textTheme.headline6.copyWith(color: AColors.grey3A, fontStyle: FontStyle.italic),
// ),
// ),
// ),
// const SizedBox(
// width: 48,
// )
// ],
// ),
// ],
// ),
// ),
// Padding(
// padding: const EdgeInsets.symmetric(horizontal: 16.0),
// child: ASwitchButton(
// title: "Most Recent",
// value: mostRecent,
// onChange: (value) async {
// mostRecent = value;
// _gasRefillProvider.reset();
// await _gasRefillProvider.getRequests(
// user: _userProvider.user,
// host: _settingProvider.host,
// mostRecent: mostRecent,
// );
// },
// ),
// ),
Expanded(
child: GasRefillList(
nextPage: _gasRefillProvider.nextPage,

@ -1,10 +1,7 @@
import 'package:flutter/material.dart';
import 'package:test_sa/controllers/localization/localization.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/models/gas_refill/gas_refill_model.dart';
import 'package:test_sa/views/app_style/colors.dart';
import 'package:test_sa/views/app_style/sizing.dart';
import 'package:test_sa/views/widgets/requests/request_status.dart';
import '../../../models/gas_refill/gas_refill_model.dart';
class GasRefillItem extends StatelessWidget {
final int index;
@ -15,20 +12,17 @@ class GasRefillItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
Color itemColor = index % 2 == 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.onPrimary;
Color onItemColor = index % 2 != 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.onPrimary;
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
backgroundColor: itemColor,
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context)),
),
),
//padding: EdgeInsets.symmetric(vertical: 8,horizontal: 8),
onPressed: () {
onPressed(item);
},
@ -37,74 +31,81 @@ class GasRefillItem extends StatelessWidget {
children: [
Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
item.title ?? "-----",
style: Theme.of(context).textTheme.titleLarge.copyWith(color: onItemColor, fontSize: 16, fontWeight: FontWeight.bold),
),
Row(
children: [
Expanded(
child: Text(
context.translation.hospital,
style: Theme.of(context).textTheme.titleSmall.copyWith(
color: onItemColor,
),
),
),
if (item.clientName != null)
Text(
item.clientName,
style: Theme.of(context).textTheme.titleSmall.copyWith(
color: onItemColor,
),
),
],
),
Divider(color: onItemColor),
Row(
children: [
Expanded(
child: Text(context.translation.status, style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
),
if (item.status?.id != null) StatusLabel(label: item.status.name, backgroundColor: AColors.getGasStatusColor(item.status.id)),
],
),
if (item?.expectedDate != null) Divider(color: onItemColor),
if (item?.expectedDate != null)
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("Expected Date", style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
Text(item.expectedDate.toIso8601String().split("T").first, style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
Text("priority"),
Text("process"),
],
),
if (item?.details?.isNotEmpty ?? false) Divider(color: onItemColor),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (item?.details?.isNotEmpty ?? false) Text("Gas Type", style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: item.details
.map(
(gas) => gas?.type?.name?.isNotEmpty ?? false
? Text(gas?.type?.name, style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor))
: const SizedBox.shrink(),
)
.toList(),
)
],
),
],
),
),
],
),
// Row(
// children: [
// Expanded(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// item.title ?? "-----",
// style: Theme.of(context).textTheme.titleLarge.copyWith(color: onItemColor, fontSize: 16, fontWeight: FontWeight.bold),
// ),
// Row(
// children: [
// Expanded(
// child: Text(
// subtitle.hospital,
// style: Theme.of(context).textTheme.titleSmall.copyWith(
// color: onItemColor,
// ),
// ),
// ),
// if (item.clientName != null)
// Text(
// item.clientName,
// style: Theme.of(context).textTheme.titleSmall.copyWith(
// color: onItemColor,
// ),
// ),
// ],
// ),
// Divider(color: onItemColor),
// Row(
// children: [
// Expanded(
// child: Text(subtitle.status, style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
// ),
// if (item.status?.id != null) StatusLabel(label: item.status.name, color: AColors.getGasStatusColor(item.status.id)),
// ],
// ),
// if (item?.expectedDate != null) Divider(color: onItemColor),
// if (item?.expectedDate != null)
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text("Expected Date", style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
// Text(item.expectedDate.toIso8601String().split("T").first, style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
// ],
// ),
// if (item?.details?.isNotEmpty ?? false) Divider(color: onItemColor),
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// if (item?.details?.isNotEmpty ?? false) Text("Gas Type", style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
// Column(
// crossAxisAlignment: CrossAxisAlignment.end,
// children: item.details
// .map(
// (gas) => gas?.type?.name?.isNotEmpty ?? false
// ? Text(gas?.type?.name, style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor))
// : const SizedBox.shrink(),
// )
// .toList(),
// )
// ],
// ),
// ],
// ),
// ),
// ],
// ),
],
),
),

@ -97,6 +97,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.1"
buttons_tabbar:
dependency: "direct main"
description:
name: buttons_tabbar
sha256: "781128180f3e76cf93c093183f10395c664983dbee20bc4da2025be70085c2da"
url: "https://pub.dev"
source: hosted
version: "1.3.7+1"
cached_network_image:
dependency: "direct main"
description:

@ -68,6 +68,7 @@ dependencies:
path_provider: ^2.1.0
open_file: ^3.3.2
localization: ^2.1.0
buttons_tabbar: ^1.3.7+1
dev_dependencies:
flutter_test:

Loading…
Cancel
Save