|
|
@@ -19,6 +19,7 @@ import 'package:telnow_mobile_new/src/layouts/mobile/request_create.dart';
|
|
|
import 'package:telnow_mobile_new/src/layouts/mobile/request_select.dart';
|
|
|
import 'package:telnow_mobile_new/src/layouts/components/template.dart';
|
|
|
import 'package:telnow_mobile_new/src/storage/sharedpreferences/shared_preferences_manager.dart';
|
|
|
+import 'package:telnow_mobile_new/src/utils/C.dart';
|
|
|
import 'package:telnow_mobile_new/src/utils/U.dart';
|
|
|
import 'package:telnow_mobile_new/src/utils/cache_manager.dart';
|
|
|
import 'package:telnow_mobile_new/src/utils/provider.dart';
|
|
|
@@ -35,6 +36,7 @@ class _MobHomePageState extends State<MobHomePage> with WidgetsBindingObserver {
|
|
|
final HomeFunction homeFunc = HomeFunction();
|
|
|
final SharedPreferencesManager sharedPreferencesManager = locator<SharedPreferencesManager>();
|
|
|
bool _timeLimit = false;
|
|
|
+ String _localeIndex = 'id';
|
|
|
|
|
|
@override
|
|
|
void initState() {
|
|
|
@@ -53,10 +55,18 @@ class _MobHomePageState extends State<MobHomePage> with WidgetsBindingObserver {
|
|
|
});
|
|
|
});
|
|
|
WidgetsBinding.instance.addObserver(this);
|
|
|
+ checkCompatibility();
|
|
|
// TODO: implement initState
|
|
|
super.initState();
|
|
|
}
|
|
|
|
|
|
+ checkCompatibility() async{
|
|
|
+ var isCompatible = await U.isCompatibleWith(VersionKey.multiBahasa);
|
|
|
+ if(isCompatible) {
|
|
|
+ homeFunc.getContactCenter(context);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@override
|
|
|
void dispose() {
|
|
|
WidgetsBinding.instance.removeObserver(this);
|
|
|
@@ -65,69 +75,103 @@ class _MobHomePageState extends State<MobHomePage> with WidgetsBindingObserver {
|
|
|
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
+ _localeIndex = U.newServerVersion(1754624839) ? U.getLangIndex(context.locale.toString()) : context.locale.toString();
|
|
|
return Provider.of<UserModule>(context).user().isNotEmpty?Scaffold(
|
|
|
backgroundColor: backgroundColor,
|
|
|
- appBar: PreferredSize(preferredSize: Size.fromHeight(0), child: AppBar(elevation: 0, backgroundColor: primaryColor)),
|
|
|
body: Column(
|
|
|
children: [
|
|
|
Container(
|
|
|
width: double.infinity,
|
|
|
color: primaryColor,
|
|
|
- padding: EdgeInsets.fromLTRB(16, 8, 16, 8),
|
|
|
- child: Column(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: [
|
|
|
- Text('${Provider.of<UserModule>(context).user()['name']}${(Provider.of<UserModule>(context).user()['guestName']!=null&&Provider.of<UserModule>(context).user()['guestName']!=''?' - ${Provider.of<UserModule>(context).user()['guestName']}':'')}', style: TextStyle(color: Colors.white, fontSize: 18), overflow: TextOverflow.ellipsis),
|
|
|
- Provider.of<UserModule>(context).profile()['greeting'][context.locale.toString()] != null ? Text(Provider.of<UserModule>(context).profile()['greeting'][context.locale.toString()], style: TextStyle(color: Colors.white, fontSize: 14), overflow: TextOverflow.ellipsis) : Container(),
|
|
|
- SizedBox(height: 16),
|
|
|
- Row(
|
|
|
- children: [
|
|
|
- Expanded(
|
|
|
- child: GestureDetector(
|
|
|
- child: Container(
|
|
|
- padding: EdgeInsets.fromLTRB(20, 13, 20, 13),
|
|
|
- child: Row(
|
|
|
- children: [
|
|
|
- U.iconsax('search-normal-1', color: textColor),
|
|
|
- SizedBox(width: 13),
|
|
|
- Expanded(child: Text(Provider.of<UserModule>(context).profile()['searchText'][context.locale.toString()] != null ? Provider.of<UserModule>(context).profile()['searchText'][context.locale.toString()] : 'searchAsk'.tr(), style: TextStyle(color: textColor.withValues(alpha: 0.5), fontSize: 14), overflow: TextOverflow.ellipsis))
|
|
|
- ],
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
|
|
+ child: SafeArea(
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ children: [
|
|
|
+ Text('${Provider.of<UserModule>(context).user()['name']}${(Provider.of<UserModule>(context).user()['guestName'] != null && Provider.of<UserModule>(context).user()['guestName'] != '' ? ' - ${Provider.of<UserModule>(context).user()['guestName']}' : '')}', style: TextStyle(color: Colors.white, fontSize: 18), overflow: TextOverflow.ellipsis),
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ //TODO: tambah pengecekan server version disini
|
|
|
+ FutureBuilder<bool>(
|
|
|
+ future: U.isCompatibleWith(VersionKey.multiBahasa),
|
|
|
+ builder: (context, snapshot) {
|
|
|
+ if (!snapshot.hasData) {
|
|
|
+ return SizedBox(); // or a loading spinner
|
|
|
+ }
|
|
|
+
|
|
|
+ final isCompatible = snapshot.data!;
|
|
|
+ final hasContactCenter = Provider.of<ServiceModule>(context, listen: false)
|
|
|
+ .contactCenter()
|
|
|
+ .toString()
|
|
|
+ .isNotEmpty;
|
|
|
+
|
|
|
+ if (isCompatible && hasContactCenter) {
|
|
|
+ return GestureDetector(
|
|
|
+ onTap: () => launchUrl(Uri.parse(Provider.of<ServiceModule>(context, listen: false).contactCenter().toString())),
|
|
|
+ child: U.iconsax('phone-number', color: Colors.white, size: 26.0)
|
|
|
+ ); // replace with the widget you want to show
|
|
|
+ } else {
|
|
|
+ return SizedBox(); // or nothing
|
|
|
+ }
|
|
|
+ },
|
|
|
),
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Colors.white,
|
|
|
- borderRadius: BorderRadius.all(Radius.circular(50))
|
|
|
+ // U.isCompatibleWith(VersionKey.multiBahasa) && Provider.of<ServiceModule>(context, listen: false).contactCenter().toString() != '' ? GestureDetector(
|
|
|
+ // onTap: () => launchUrl(Uri.parse(Provider.of<ServiceModule>(context, listen: false).contactCenter().toString())),
|
|
|
+ // child: U.iconsax('phone-number', color: Colors.white, size: 26.0)
|
|
|
+ // ):SizedBox(),
|
|
|
+ SizedBox(width: 8),
|
|
|
+ GestureDetector(
|
|
|
+ child: Stack(
|
|
|
+ alignment: Alignment.topRight,
|
|
|
+ children: [
|
|
|
+ U.iconsax('sms-notification', color: Colors.white, size: 32.0),
|
|
|
+ Provider.of<ServiceModule>(context).unreadMessage() ? Container(
|
|
|
+ width: 13, height: 13, margin: EdgeInsets.only(top: 1.3),
|
|
|
+ decoration: BoxDecoration(color: Colors.red, borderRadius: BorderRadius.all(Radius.circular(50))),
|
|
|
+ ):Container()
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ onTap: ()=>navigateTo(context, MobMessageListPage(Provider.of<UserModule>(context, listen: false).user())).then((_){
|
|
|
+ homeFunc.getUnreadMessages(context);
|
|
|
+ }),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ Provider.of<UserModule>(context).profile()['greeting'][context.locale.toString()] != null ? Text(Provider.of<UserModule>(context).profile()['greeting'][context.locale.toString()], style: TextStyle(color: Colors.white, fontSize: 14), overflow: TextOverflow.ellipsis) : Container(),
|
|
|
+ SizedBox(height: 8),
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ Expanded(
|
|
|
+ child: GestureDetector(
|
|
|
+ child: Container(
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 20, vertical: 12,),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Colors.white,
|
|
|
+ borderRadius: BorderRadius.all(Radius.circular(50))
|
|
|
+ ),
|
|
|
+ child: Row(
|
|
|
+ children: [
|
|
|
+ U.iconsax('search-normal-1', color: textColor),
|
|
|
+ SizedBox(width: 13),
|
|
|
+ Expanded(child: Text(Provider.of<UserModule>(context).profile()['searchText'][context.locale.toString()] != null ? Provider.of<UserModule>(context).profile()['searchText'][context.locale.toString()] : 'searchAsk'.tr(), style: TextStyle(color: textColor.withValues(alpha: 0.5), fontSize: 14), overflow: TextOverflow.ellipsis))
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- onTap: () => navigateTo(context, MobReqSelectPage(user: Provider.of<UserModule>(context, listen: false).user(), title: 'search'.tr(), scope: Provider.of<ServiceModule>(context, listen: false).scoopeValue(), placeholder: Provider.of<UserModule>(context, listen: false).profile()['searchText'][context.locale.toString()] != null ? Provider.of<UserModule>(context, listen: false).profile()['searchText'][context.locale.toString()] : 'searchAsk'.tr())).then((val){
|
|
|
- val = val??true;
|
|
|
- if(val) homeFunc.getFrequentlyRequested(context);
|
|
|
- }),
|
|
|
- ),
|
|
|
- ),
|
|
|
- SizedBox(width: 12),
|
|
|
- GestureDetector(
|
|
|
- child: Container(
|
|
|
- padding: EdgeInsets.all(13),
|
|
|
- child: Stack(
|
|
|
- alignment: Alignment.topRight,
|
|
|
- children: [
|
|
|
- U.iconsax('sms-notification', color: primaryColor),
|
|
|
- Provider.of<ServiceModule>(context).unreadMessage() ? Container(
|
|
|
- width: 11, height: 11, margin: EdgeInsets.only(top: 1.3),
|
|
|
- decoration: BoxDecoration(color: Colors.red, borderRadius: BorderRadius.all(Radius.circular(50))),
|
|
|
- ):Container()
|
|
|
- ],
|
|
|
- ),
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Colors.white,
|
|
|
- borderRadius: BorderRadius.all(Radius.circular(50))
|
|
|
+ onTap: () => navigateTo(context, MobReqSelectPage(user: Provider.of<UserModule>(context, listen: false).user(), title: 'search'.tr(), scope: Provider.of<ServiceModule>(context, listen: false).scoopeValue(), placeholder: Provider.of<UserModule>(context, listen: false).profile()['searchText'][context.locale.toString()] != null ? Provider.of<UserModule>(context, listen: false).profile()['searchText'][context.locale.toString()] : 'searchAsk'.tr())).then((val){
|
|
|
+ val = val??true;
|
|
|
+ if(val) homeFunc.getFrequentlyRequested(context);
|
|
|
+ }),
|
|
|
),
|
|
|
),
|
|
|
- onTap: ()=>navigateTo(context, MobMessageListPage(Provider.of<UserModule>(context, listen: false).user())),
|
|
|
- )
|
|
|
- ],
|
|
|
- )
|
|
|
- ],
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
Expanded(
|
|
|
@@ -172,55 +216,57 @@ class _MobHomePageState extends State<MobHomePage> with WidgetsBindingObserver {
|
|
|
context: context,
|
|
|
backgroundColor: Colors.white,
|
|
|
builder: (BuildContext contexts) {
|
|
|
- return Column(
|
|
|
- mainAxisSize: MainAxisSize.min,
|
|
|
- children: [
|
|
|
- Container(
|
|
|
- margin: EdgeInsets.symmetric(vertical: 16),
|
|
|
- child: Text('changeScope'.tr(), style: TextStyle(color: textColor, fontSize: 14), textAlign: TextAlign.center),
|
|
|
- ),
|
|
|
- divider(),
|
|
|
- SizedBox(height: 16),
|
|
|
- Column(
|
|
|
- children: List.generate(Provider.of<ServiceModule>(context).getScoopeLength(), (i){
|
|
|
- return GestureDetector(
|
|
|
- child: Container(
|
|
|
- color: Colors.white,
|
|
|
- padding: EdgeInsets.symmetric(vertical: 16, horizontal: 16),
|
|
|
- child: Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
- children: [
|
|
|
- Text(Provider.of<ServiceModule>(context).scoope()[i]['value'], style: TextStyle(color: textColor, fontSize: 14)),
|
|
|
- Icon(Provider.of<ServiceModule>(context).checkScoope(Provider.of<ServiceModule>(context).scoope()[i]['key'])?Icons.radio_button_checked:Icons.radio_button_off, color: Provider.of<ServiceModule>(context).checkScoope(Provider.of<ServiceModule>(context).scoope()[i]['key'])?primaryColor:Colors.black45, size: 22),
|
|
|
- ],
|
|
|
+ return SafeArea(
|
|
|
+ child: Column(
|
|
|
+ mainAxisSize: MainAxisSize.min,
|
|
|
+ children: [
|
|
|
+ Container(
|
|
|
+ margin: EdgeInsets.symmetric(vertical: 16),
|
|
|
+ child: Text('changeScope'.tr(), style: TextStyle(color: textColor, fontSize: 14), textAlign: TextAlign.center),
|
|
|
+ ),
|
|
|
+ divider(),
|
|
|
+ SizedBox(height: 16),
|
|
|
+ Column(
|
|
|
+ children: List.generate(Provider.of<ServiceModule>(context).getScoopeLength(), (i){
|
|
|
+ return GestureDetector(
|
|
|
+ child: Container(
|
|
|
+ color: Colors.white,
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 16, horizontal: 16),
|
|
|
+ child: Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ children: [
|
|
|
+ Text(Provider.of<ServiceModule>(context).scoope()[i]['value'], style: TextStyle(color: textColor, fontSize: 14)),
|
|
|
+ Icon(Provider.of<ServiceModule>(context).checkScoope(Provider.of<ServiceModule>(context).scoope()[i]['key'])?Icons.radio_button_checked:Icons.radio_button_off, color: Provider.of<ServiceModule>(context).checkScoope(Provider.of<ServiceModule>(context).scoope()[i]['key'])?primaryColor:Colors.black45, size: 22),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- onTap: () async{
|
|
|
- await sharedPreferencesManager.putString(SharedPreferencesManager.keyScoope, Provider.of<ServiceModule>(context, listen: false).scoope()[i]['key']);
|
|
|
- Provider.of<ServiceModule>(context, listen: false).setScoopeValue(Provider.of<ServiceModule>(context, listen: false).scoope()[i]['key']);
|
|
|
- Provider.of<ServiceModule>(context, listen: false).setScoopeName(Provider.of<ServiceModule>(context, listen: false).scoope()[i]['value']);
|
|
|
- Navigator.of(contexts).pop();
|
|
|
-
|
|
|
- var profile = Provider.of<UserModule>(context, listen: false).profile();
|
|
|
- if(profile['topMenu']['show'] != null && profile['topMenu']['show'] == true) {
|
|
|
- if(U.newServerVersion(1709864293)){
|
|
|
- homeFunc.getTopMenuNew(context);
|
|
|
- }
|
|
|
- else{
|
|
|
- homeFunc.getTopMenu(context);
|
|
|
- homeFunc.getReqGroup(context);
|
|
|
+ onTap: () async{
|
|
|
+ await sharedPreferencesManager.putString(SharedPreferencesManager.keyScoope, Provider.of<ServiceModule>(context, listen: false).scoope()[i]['key']);
|
|
|
+ Provider.of<ServiceModule>(context, listen: false).setScoopeValue(Provider.of<ServiceModule>(context, listen: false).scoope()[i]['key']);
|
|
|
+ Provider.of<ServiceModule>(context, listen: false).setScoopeName(Provider.of<ServiceModule>(context, listen: false).scoope()[i]['value']);
|
|
|
+ Navigator.of(contexts).pop();
|
|
|
+
|
|
|
+ var profile = Provider.of<UserModule>(context, listen: false).profile();
|
|
|
+ if(profile['topMenu']['show'] != null && profile['topMenu']['show'] == true) {
|
|
|
+ if(U.newServerVersion(1709864293)){
|
|
|
+ homeFunc.getTopMenuNew(context);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ homeFunc.getTopMenu(context);
|
|
|
+ homeFunc.getReqGroup(context);
|
|
|
+ }
|
|
|
}
|
|
|
+ if(profile['specialOffer'] != null && profile['specialOffer']['show'] == true) homeFunc.getSpecialOffer(context);
|
|
|
+ if(profile['frequentlyRequested'] != null && profile['frequentlyRequested']['show'] == true) homeFunc.getFrequentlyRequested(context);
|
|
|
+ if(profile['banner'] != null && profile['banner']['show'] == true) homeFunc.getBanner(context);
|
|
|
+ if(profile['quickAction'] != null && profile['quickAction']['show'] == true) homeFunc.getQuickAction(context);
|
|
|
}
|
|
|
- if(profile['specialOffer'] != null && profile['specialOffer']['show'] == true) homeFunc.getSpecialOffer(context);
|
|
|
- if(profile['frequentlyRequested'] != null && profile['frequentlyRequested']['show'] == true) homeFunc.getFrequentlyRequested(context);
|
|
|
- if(profile['banner'] != null && profile['banner']['show'] == true) homeFunc.getBanner(context);
|
|
|
- if(profile['quickAction'] != null && profile['quickAction']['show'] == true) homeFunc.getQuickAction(context);
|
|
|
- }
|
|
|
- );
|
|
|
- }),
|
|
|
- ),
|
|
|
- SizedBox(height: 16),
|
|
|
- ],
|
|
|
+ );
|
|
|
+ }),
|
|
|
+ ),
|
|
|
+ SizedBox(height: 16),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
);
|
|
|
},
|
|
|
);
|
|
|
@@ -291,7 +337,12 @@ class _MobHomePageState extends State<MobHomePage> with WidgetsBindingObserver {
|
|
|
child: Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
children: [
|
|
|
- Padding(padding: EdgeInsets.only(left: 16), child: Text(Provider.of<UserModule>(context).profile()['specialOffer']['label'][context.locale.toString()]??'Not Set', style: TextStyle(color: textColor, fontSize: 17, fontWeight: FontWeight.w500))),
|
|
|
+ Padding(
|
|
|
+ padding: EdgeInsetsDirectional.only(start: 16),
|
|
|
+ child: Text(
|
|
|
+ Provider.of<UserModule>(context).profile()['specialOffer']['label'][_localeIndex]??'Not Set',
|
|
|
+ style: TextStyle(color: textColor, fontSize: 17, fontWeight: FontWeight.w500),
|
|
|
+ )),
|
|
|
SizedBox(height: 12),
|
|
|
Provider.of<ServiceModule>(context).specialOffer().length > 0 ? SingleChildScrollView(
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
@@ -301,6 +352,11 @@ class _MobHomePageState extends State<MobHomePage> with WidgetsBindingObserver {
|
|
|
width: U.bodyWidth(context) - 60,
|
|
|
margin: EdgeInsets.only(left: i==0?16:0, right: 16),
|
|
|
padding: EdgeInsets.only(right: 16),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Colors.white,
|
|
|
+ border: Border.all(color: textColor.withValues(alpha: 0.15)),
|
|
|
+ borderRadius: BorderRadius.all(Radius.circular(12))
|
|
|
+ ),
|
|
|
child: Row(
|
|
|
children: [
|
|
|
imageTiles(imageUrl: Provider.of<ServiceModule>(context).specialOffer()[i]['_mobileImage'] ?? "null"),
|
|
|
@@ -317,11 +373,6 @@ class _MobHomePageState extends State<MobHomePage> with WidgetsBindingObserver {
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Colors.white,
|
|
|
- border: Border.all(color: textColor.withValues(alpha: 0.15)),
|
|
|
- borderRadius: BorderRadius.all(Radius.circular(12))
|
|
|
- ),
|
|
|
),
|
|
|
onTap: ()=>navigateTo(context, MobReqCreatePage(user: Provider.of<UserModule>(context, listen: false).user(), request: Provider.of<ServiceModule>(context, listen: false).specialOffer()[i])),
|
|
|
)),
|
|
|
@@ -336,7 +387,7 @@ class _MobHomePageState extends State<MobHomePage> with WidgetsBindingObserver {
|
|
|
child: Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
children: [
|
|
|
- Padding(padding: EdgeInsets.only(left: 16), child: Text(Provider.of<UserModule>(context).profile()['frequentlyRequested']['label'][context.locale.toString()]??'Not Set', style: TextStyle(color: textColor, fontSize: 17, fontWeight: FontWeight.w500))),
|
|
|
+ Padding(padding: EdgeInsetsDirectional.only(start: 16), child: Text(Provider.of<UserModule>(context).profile()['frequentlyRequested']['label'][_localeIndex]??'Not Set', style: TextStyle(color: textColor, fontSize: 17, fontWeight: FontWeight.w500))),
|
|
|
SizedBox(height: 12),
|
|
|
Provider.of<ServiceModule>(context).data().length > 0 ? SingleChildScrollView(
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
@@ -347,6 +398,11 @@ class _MobHomePageState extends State<MobHomePage> with WidgetsBindingObserver {
|
|
|
child: Container(
|
|
|
margin: EdgeInsets.only(left: i==0?16:0, right: 16),
|
|
|
width: U.bodyWidth(context)/(kIsWeb?3.8:2.6), height: U.bodyWidth(context)/(kIsWeb?3:2),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Colors.white,
|
|
|
+ border: Border.all(color: textColor.withValues(alpha: 0.15)),
|
|
|
+ borderRadius: BorderRadius.all(Radius.circular(12))
|
|
|
+ ),
|
|
|
child: Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
children: [
|
|
|
@@ -369,7 +425,7 @@ class _MobHomePageState extends State<MobHomePage> with WidgetsBindingObserver {
|
|
|
child: Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
children: [
|
|
|
- Text(Provider.of<ServiceModule>(context).data()[i][U.langColumn(context, 'subject')], style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
|
|
|
+ Text(Provider.of<ServiceModule>(context).data()[i][U.langColumn(context, 'subject')]??'', style: TextStyle(color: textColor), overflow: TextOverflow.ellipsis),
|
|
|
SizedBox(height: 5),
|
|
|
Text(Provider.of<ServiceModule>(context).data()[i]['_frequentlyCount'].toString() + 'times'.tr(), style: TextStyle(color: textColor, fontSize: 14, fontWeight: FontWeight.w500), overflow: TextOverflow.ellipsis)
|
|
|
],
|
|
|
@@ -377,11 +433,6 @@ class _MobHomePageState extends State<MobHomePage> with WidgetsBindingObserver {
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Colors.white,
|
|
|
- border: Border.all(color: textColor.withValues(alpha: 0.15)),
|
|
|
- borderRadius: BorderRadius.all(Radius.circular(12))
|
|
|
- ),
|
|
|
),
|
|
|
onTap: ()=>navigateTo(context, MobReqCreatePage(user: Provider.of<UserModule>(context, listen: false).user(), request: Provider.of<ServiceModule>(context, listen: false).data()[i])).then((val){
|
|
|
val = val??true;
|
|
|
@@ -400,7 +451,7 @@ class _MobHomePageState extends State<MobHomePage> with WidgetsBindingObserver {
|
|
|
child: Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
children: [
|
|
|
- Text(Provider.of<UserModule>(context).profile()['banner']['label'][context.locale.toString()]??'Not Set', style: TextStyle(color: textColor, fontSize: 17, fontWeight: FontWeight.w500)),
|
|
|
+ Text(Provider.of<UserModule>(context).profile()['banner']['label'][_localeIndex]??'Not Set', style: TextStyle(color: textColor, fontSize: 17, fontWeight: FontWeight.w500)),
|
|
|
SizedBox(height: 12),
|
|
|
Provider.of<ServiceModule>(context).banner().isNotEmpty ? CarouselSlider.builder(
|
|
|
itemCount: Provider.of<ServiceModule>(context).banner().length,
|
|
|
@@ -419,6 +470,11 @@ class _MobHomePageState extends State<MobHomePage> with WidgetsBindingObserver {
|
|
|
itemBuilder: (BuildContext context, int i, int pageViewIndex) => GestureDetector(
|
|
|
child: Container(
|
|
|
width: double.infinity,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Colors.white,
|
|
|
+ border: Border.all(color: textColor.withValues(alpha: 0.15)),
|
|
|
+ borderRadius: BorderRadius.all(Radius.circular(12))
|
|
|
+ ),
|
|
|
child: Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
children: [
|
|
|
@@ -474,11 +530,6 @@ class _MobHomePageState extends State<MobHomePage> with WidgetsBindingObserver {
|
|
|
)
|
|
|
],
|
|
|
),
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Colors.white,
|
|
|
- border: Border.all(color: textColor.withValues(alpha: 0.15)),
|
|
|
- borderRadius: BorderRadius.all(Radius.circular(12))
|
|
|
- ),
|
|
|
),
|
|
|
onTap: ()=>navigateTo(context, MobBannerDetailPage(user: Provider.of<UserModule>(context, listen: false).user(), data: Provider.of<ServiceModule>(context, listen: false).banner()[i])).then((val){
|
|
|
val = val??true;
|
|
|
@@ -495,14 +546,28 @@ class _MobHomePageState extends State<MobHomePage> with WidgetsBindingObserver {
|
|
|
child: Column(
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
children: [
|
|
|
- Text(Provider.of<UserModule>(context).profile()['quickAction']['label'][context.locale.toString()]??'Not Set', style: TextStyle(color: textColor, fontSize: 17, fontWeight: FontWeight.w500)),
|
|
|
+ Text(Provider.of<UserModule>(context).profile()['quickAction']['label'][_localeIndex]??'Not Set', style: TextStyle(color: textColor, fontSize: 17, fontWeight: FontWeight.w500)),
|
|
|
SizedBox(height: 12),
|
|
|
Provider.of<ServiceModule>(context).quickAct().length > 0 ? Container(
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Colors.white,
|
|
|
+ border: Border.all(color: textColor.withValues(alpha: 0.15)),
|
|
|
+ borderRadius: BorderRadius.all(Radius.circular(12))
|
|
|
+ ),
|
|
|
child: Column(
|
|
|
children: List.generate(Provider.of<ServiceModule>(context).quickAct().length, (i){
|
|
|
return GestureDetector(
|
|
|
child: Container(
|
|
|
padding: EdgeInsets.all(12),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Colors.white,
|
|
|
+ borderRadius: BorderRadius.only(
|
|
|
+ topLeft: Radius.circular(i==0?12:0),
|
|
|
+ topRight: Radius.circular(i==0?12:0),
|
|
|
+ bottomLeft: Radius.circular(i==Provider.of<ServiceModule>(context).quickAct().length-1?12:0),
|
|
|
+ bottomRight: Radius.circular(i==Provider.of<ServiceModule>(context).quickAct().length-1?12:0),
|
|
|
+ )
|
|
|
+ ),
|
|
|
child: Row(
|
|
|
children: [
|
|
|
imageTiles(imageUrl: Provider.of<ServiceModule>(context).quickAct()[i]['_mobileImage'] ?? "null", width: 50, height: 40, radius: 5),
|
|
|
@@ -513,25 +578,11 @@ class _MobHomePageState extends State<MobHomePage> with WidgetsBindingObserver {
|
|
|
U.iconsax('arrow-right-3', size: 14, color: textColor.withValues(alpha: 0.75)),
|
|
|
],
|
|
|
),
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Colors.white,
|
|
|
- borderRadius: BorderRadius.only(
|
|
|
- topLeft: Radius.circular(i==0?12:0),
|
|
|
- topRight: Radius.circular(i==0?12:0),
|
|
|
- bottomLeft: Radius.circular(i==Provider.of<ServiceModule>(context).quickAct().length-1?12:0),
|
|
|
- bottomRight: Radius.circular(i==Provider.of<ServiceModule>(context).quickAct().length-1?12:0),
|
|
|
- )
|
|
|
- ),
|
|
|
),
|
|
|
onTap: ()=>navigateTo(context, MobReqCreatePage(user: Provider.of<UserModule>(context, listen: false).user(), request: Provider.of<ServiceModule>(context, listen: false).quickAct()[i])),
|
|
|
);
|
|
|
}),
|
|
|
),
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: Colors.white,
|
|
|
- border: Border.all(color: textColor.withValues(alpha: 0.15)),
|
|
|
- borderRadius: BorderRadius.all(Radius.circular(12))
|
|
|
- ),
|
|
|
) : emptyWidget(left: 0)
|
|
|
],
|
|
|
),
|
|
|
@@ -619,11 +670,11 @@ class _MobMenuDisplayPageState extends State<MobMenuDisplayPage> {
|
|
|
child: Container(
|
|
|
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
|
|
margin: EdgeInsets.only(right: 15),
|
|
|
- child: Text('customize'.tr(), style: TextStyle(color: primaryColor, fontSize: 14)),
|
|
|
decoration: BoxDecoration(
|
|
|
color: primaryColor.withValues(alpha: 0.1),
|
|
|
borderRadius: BorderRadius.all(Radius.circular(50))
|
|
|
),
|
|
|
+ child: Text('customize'.tr(), style: TextStyle(color: primaryColor, fontSize: 14)),
|
|
|
),
|
|
|
onTap: (){
|
|
|
navigateTo(context, MobMenuEditorPage(scope: widget.scope));
|
|
|
@@ -669,30 +720,32 @@ class _MobMenuDisplayPageState extends State<MobMenuDisplayPage> {
|
|
|
Expanded(
|
|
|
child: SingleChildScrollView(
|
|
|
padding: EdgeInsets.fromLTRB(16, 5, 16, 16),
|
|
|
- child: Column(
|
|
|
- children: List.generate((Provider.of<ServiceModule>(context).reqGroup()!.length/4).ceil(), (i){
|
|
|
- return Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: List.generate(4, (j){
|
|
|
- int index = i==0?j:j+(4*i);
|
|
|
- return index < Provider.of<ServiceModule>(context).reqGroup()!.length ? GestureDetector(
|
|
|
- child: Column(
|
|
|
- children: [
|
|
|
- i>0?SizedBox(height: 16):Container(),
|
|
|
- categoryContainer(context: context, iconUrl: Provider.of<ServiceModule>(context).reqGroup()![index]['iconUrl']),
|
|
|
- SizedBox(height: 8),
|
|
|
- SizedBox(
|
|
|
- width: 70,
|
|
|
- child: Text(U.servantDisplay() ? Provider.of<ServiceModule>(context).reqGroup()![index]['description'] : Provider.of<ServiceModule>(context).reqGroup()![index][U.langColumn(context, 'description')], style: TextStyle(color: textColor, fontSize: 12, fontWeight: FontWeight.w300), maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center),
|
|
|
- )
|
|
|
- ],
|
|
|
- ),
|
|
|
- onTap: ()=>navigateTo(context, MobReqSelectPage(user: Provider.of<UserModule>(context, listen: false).user(), title: U.servantDisplay() ? Provider.of<ServiceModule>(context, listen: false).reqGroup()![index]['description'] : Provider.of<ServiceModule>(context, listen: false).reqGroup()![index][U.langColumn(context, 'description')], scope: widget.scope, groupCode: Provider.of<ServiceModule>(context, listen: false).reqGroup()![index]['code'])),
|
|
|
- ) : Container(width: 70);
|
|
|
- }),
|
|
|
- );
|
|
|
- }),
|
|
|
+ child: SafeArea(
|
|
|
+ child: Column(
|
|
|
+ children: List.generate((Provider.of<ServiceModule>(context).reqGroup()!.length/4).ceil(), (i){
|
|
|
+ return Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: List.generate(4, (j){
|
|
|
+ int index = i==0?j:j+(4*i);
|
|
|
+ return index < Provider.of<ServiceModule>(context).reqGroup()!.length ? GestureDetector(
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ i>0?SizedBox(height: 16):Container(),
|
|
|
+ categoryContainer(context: context, iconUrl: Provider.of<ServiceModule>(context).reqGroup()![index]['iconUrl']),
|
|
|
+ SizedBox(height: 8),
|
|
|
+ SizedBox(
|
|
|
+ width: 70,
|
|
|
+ child: Text(U.servantDisplay() ? Provider.of<ServiceModule>(context).reqGroup()![index]['description'] : Provider.of<ServiceModule>(context).reqGroup()![index][U.langColumn(context, 'description')], style: TextStyle(color: textColor, fontSize: 12, fontWeight: FontWeight.w300), maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ onTap: ()=>navigateTo(context, MobReqSelectPage(user: Provider.of<UserModule>(context, listen: false).user(), title: U.servantDisplay() ? Provider.of<ServiceModule>(context, listen: false).reqGroup()![index]['description'] : Provider.of<ServiceModule>(context, listen: false).reqGroup()![index][U.langColumn(context, 'description')], scope: widget.scope, groupCode: Provider.of<ServiceModule>(context, listen: false).reqGroup()![index]['code'])),
|
|
|
+ ) : Container(width: 70);
|
|
|
+ }),
|
|
|
+ );
|
|
|
+ }),
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
)
|
|
|
@@ -829,42 +882,44 @@ class _MobMenuEditorPageState extends State<MobMenuEditorPage> {
|
|
|
margin: EdgeInsets.fromLTRB(16, 16, 16, 13),
|
|
|
child: Text('availableMenu'.tr(), style: TextStyle(color: textColor, fontSize: 17, fontWeight: FontWeight.w500)),
|
|
|
),
|
|
|
- Column(
|
|
|
- children: List.generate(available.length, (i){
|
|
|
- return Container(
|
|
|
- padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
|
|
- child: Row(
|
|
|
- children: [
|
|
|
- categoryContainer(context: context, iconUrl: available[i]['iconUrl']),
|
|
|
- SizedBox(width: 12),
|
|
|
- Expanded(
|
|
|
- child: Column(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: [
|
|
|
- Text(available[i][U.langColumn(context, 'description')], style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
|
|
|
- SizedBox(height: 4),
|
|
|
- Text(available[i][U.langColumn(context, 'description')], style: TextStyle(color: textColor, fontSize: 12, fontWeight: FontWeight.w300), overflow: TextOverflow.ellipsis),
|
|
|
- ],
|
|
|
+ SafeArea(
|
|
|
+ child: Column(
|
|
|
+ children: List.generate(available.length, (i){
|
|
|
+ return Container(
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
|
|
+ child: Row(
|
|
|
+ children: [
|
|
|
+ categoryContainer(context: context, iconUrl: available[i]['iconUrl']),
|
|
|
+ SizedBox(width: 12),
|
|
|
+ Expanded(
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Text(available[i][U.langColumn(context, 'description')], style: TextStyle(color: textColor, fontSize: 14), overflow: TextOverflow.ellipsis),
|
|
|
+ SizedBox(height: 4),
|
|
|
+ Text(available[i][U.langColumn(context, 'description')], style: TextStyle(color: textColor, fontSize: 12, fontWeight: FontWeight.w300), overflow: TextOverflow.ellipsis),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- GestureDetector(
|
|
|
- child: U.iconsax('bold/add-circle', color: Color(0xffD81010)),
|
|
|
- onTap: (){
|
|
|
- if(data.length < 7){
|
|
|
- setState(() {
|
|
|
- data.add(available[i]);
|
|
|
- available.remove(available[i]);
|
|
|
- });
|
|
|
- }
|
|
|
- else{
|
|
|
- showError(context, 'maxMenu'.tr());
|
|
|
- }
|
|
|
- },
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- );
|
|
|
- }),
|
|
|
+ GestureDetector(
|
|
|
+ child: U.iconsax('bold/add-circle', color: Color(0xffD81010)),
|
|
|
+ onTap: (){
|
|
|
+ if(data.length < 7){
|
|
|
+ setState(() {
|
|
|
+ data.add(available[i]);
|
|
|
+ available.remove(available[i]);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ showError(context, 'maxMenu'.tr());
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }),
|
|
|
+ ),
|
|
|
),
|
|
|
SizedBox(height: 8),
|
|
|
],
|