Merge branch 'refs/heads/design_3.0_TM_Module_snagsFix' into design_3.0_task_module_new_merge

design_3.0_TM_Module_snagsFix
Sikander Saleem 2 months ago
commit f3539f1471

@ -3,6 +3,7 @@ buildscript {
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
maven { url "https://jitpack.io" }
maven {url 'https://developer.huawei.com/repo/'} maven {url 'https://developer.huawei.com/repo/'}
} }

@ -1,4 +1,3 @@
org.gradle.jvmargs=-Xmx2048m org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=1024m
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true

@ -69,6 +69,9 @@ class SettingProvider extends ChangeNotifier {
await prefs.setBool(ASettings.rememberMe, rememberMe); await prefs.setBool(ASettings.rememberMe, rememberMe);
await prefs.setString(ASettings.userName, username); await prefs.setString(ASettings.userName, username);
await prefs.setString(ASettings.password, password); await prefs.setString(ASettings.password, password);
this.username = username;
this.password = password;
} }
void selectAssetGroup(User user) { void selectAssetGroup(User user) {
@ -85,7 +88,7 @@ class SettingProvider extends ChangeNotifier {
setAssetGroup(_assetGroup); setAssetGroup(_assetGroup);
} }
Future<void> setAssetGroup(AssetGroup? assetGroup) async { void setAssetGroup(AssetGroup? assetGroup) {
_assetGroup = assetGroup; _assetGroup = assetGroup;
ApiManager.instance.assetGroup = _assetGroup!; ApiManager.instance.assetGroup = _assetGroup!;
notifyListeners(); notifyListeners();

@ -297,6 +297,7 @@ class AssetGroup {
data['id'] = id; data['id'] = id;
data['name'] = name; data['name'] = name;
data['code'] = code; data['code'] = code;
data['enabledEngineerTimer'] = enabledEngineerTimer;
return data; return data;
} }
} }

@ -85,9 +85,7 @@ class _SplashPageState extends State<SplashPage> {
setState(() { setState(() {
loading = false; loading = false;
}); });
if (isValid && _settingProvider.isLocalAuthEnable) { if (isValid == false) {
handleLocalAuth();
} else {
showDialog( showDialog(
context: context, context: context,
builder: (BuildContext cxt) => SingleBtnDialog( builder: (BuildContext cxt) => SingleBtnDialog(
@ -99,6 +97,12 @@ class _SplashPageState extends State<SplashPage> {
Navigator.of(context).pushNamedAndRemoveUntil(LoginPage.routeName, (routes) => true); Navigator.of(context).pushNamedAndRemoveUntil(LoginPage.routeName, (routes) => true);
}), }),
); );
} else {
if (isValid && _settingProvider.isLocalAuthEnable) {
handleLocalAuth();
return;
}
Navigator.of(context).pushNamedAndRemoveUntil(LoginPage.routeName, (routes) => true);
} }
} }
} }

@ -82,6 +82,42 @@ class ADatePicker extends StatelessWidget {
initialDate: DateTime.now(), initialDate: DateTime.now(),
firstDate: from ?? DateTime.now(), firstDate: from ?? DateTime.now(),
lastDate: to ?? DateTime.now(), lastDate: to ?? DateTime.now(),
builder: (BuildContext context, Widget? child) {
final ThemeData currentTheme = Theme.of(context);
return Theme(
data: currentTheme.copyWith(
datePickerTheme: DatePickerThemeData(
headerBackgroundColor: AppColor.primary10,
headerForegroundColor: Colors.white,
backgroundColor: currentTheme.colorScheme.surface,
dayForegroundColor: MaterialStateColor.resolveWith((states) {
if (states.contains(MaterialState.selected)) return Colors.white;
if (states.contains(MaterialState.disabled)) return Colors.grey.withOpacity(0.6);
return currentTheme.colorScheme.onSurface;
}),
dayBackgroundColor: MaterialStateColor.resolveWith((states) => states.contains(MaterialState.selected) ? AppColor.primary10 : Colors.transparent),
yearForegroundColor: MaterialStateColor.resolveWith((states) {
if (states.contains(MaterialState.selected)) return Colors.white;
if (states.contains(MaterialState.disabled)) return Colors.grey.withOpacity(0.6);
return currentTheme.colorScheme.onSurface;
}),
yearBackgroundColor: MaterialStateColor.resolveWith((states) => states.contains(MaterialState.selected) ? AppColor.primary10 : Colors.transparent),
// todayForegroundColor: MaterialStateColor.resolveWith((states) => AppColor.primary10),
// todayBorder: BorderSide(color: AppColor.primary10.withOpacity(0.7)),
dividerColor: Colors.grey.withOpacity(0.2),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
inputDecorationTheme: const InputDecorationTheme(
focusedBorder: UnderlineInputBorder(borderSide: BorderSide(color: AppColor.primary10, width: 2)),
),
),
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(foregroundColor: AppColor.primary10),
),
iconTheme: IconThemeData(color: AppColor.primary10.withOpacity(0.7)),
),
child: child!,
);
},
); );
if (picked != null && onDatePicker != null) { if (picked != null && onDatePicker != null) {
onDatePicker!(picked); // Use null-aware operator onDatePicker!(picked); // Use null-aware operator

@ -47,10 +47,7 @@ class _MyAssetsPageState extends State<MyAssetsPage> {
_getDevice(String result, {bool isQr = false}) async { _getDevice(String result, {bool isQr = false}) async {
_devicesProvider.reset(); _devicesProvider.reset();
await _devicesProvider.getAssets( await _devicesProvider.getAssets(search: DeviceSearch(assetNo: result, assetSerialNumber: ""), isQr: isQr);
search: DeviceSearch(assetNo: result, assetSerialNumber: ""),
isQr: isQr,
);
_searchableList.clear(); _searchableList.clear();
_searchableList.addAll(_devicesProvider.devices); _searchableList.addAll(_devicesProvider.devices);
} }
@ -144,7 +141,7 @@ class _MyAssetsPageState extends State<MyAssetsPage> {
), ),
body: SafeArea( body: SafeArea(
child: LoadingManager( child: LoadingManager(
isLoading: _devicesProvider.isLoading, isLoading: false,
stateCode: _devicesProvider.stateCode, stateCode: _devicesProvider.stateCode,
isFailedLoading: _devicesProvider.devices == null, isFailedLoading: _devicesProvider.devices == null,
onRefresh: () async { onRefresh: () async {
@ -155,49 +152,54 @@ class _MyAssetsPageState extends State<MyAssetsPage> {
children: [ children: [
Expanded( Expanded(
child: _searchableList.isEmpty child: _searchableList.isEmpty
? NoDataFound(message: context.translation.noDeviceFound) ? NoDataFound(message: context.translation.noDeviceFound).center
: LazyLoading( : LazyLoading(
nextPage: _devicesProvider.nextPage, nextPage: _devicesProvider.nextPage,
onLazyLoad: () async { onLazyLoad: () async {
await _devicesProvider.getDevicesList( await _devicesProvider.getAssets(
user: _userProvider.user!, // user: _userProvider.user!,
host: _settingProvider.host!, // host: _settingProvider.host!,
hospitalId: _userProvider.user!.clientId!, // hospitalId: _userProvider.user!.clientId!,
search: _searchAsset?.copyWith(assetSerialNumber: snController.text, assetNo: numberController.text), search: _searchAsset,
// serialNumber: snController.text, // serialNumber: snController.text,
// number: numberController.text, // number: numberController.text,
); );
}, },
child: AnimatedSwitcher( child: Stack(
duration: const Duration(milliseconds: 500), children: [
child: showListView AnimatedSwitcher(
? ListView.separated( duration: const Duration(milliseconds: 500),
padding: const EdgeInsets.all(16), child: showListView
itemCount: _searchableList.length, ? ListView.separated(
separatorBuilder: (listContext, itemIndex) => 8.height, padding: const EdgeInsets.all(16),
itemBuilder: (listContext, itemIndex) { itemCount: _searchableList.length,
return AssetItemListView( separatorBuilder: (listContext, itemIndex) => 8.height,
device: _searchableList[itemIndex], itemBuilder: (listContext, itemIndex) {
onPressed: (device) { return AssetItemListView(
widget.fromBottomBar ? Navigator.of(context).pushNamed(AssetDetailPage.id, arguments: device.id) : Navigator.of(context).pop(device); device: _searchableList[itemIndex],
// Navigator.of(context).pushNamed(AssetDetailPage.id, arguments: device.id); onPressed: (device) {
widget.fromBottomBar ? Navigator.of(context).pushNamed(AssetDetailPage.id, arguments: device.id) : Navigator.of(context).pop(device);
// Navigator.of(context).pushNamed(AssetDetailPage.id, arguments: device.id);
},
);
}, },
); )
}, : GridView.builder(
) gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 188 / 261, crossAxisSpacing: 12, mainAxisSpacing: 12),
: GridView.builder( itemCount: _searchableList.length,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 188 / 261, crossAxisSpacing: 12, mainAxisSpacing: 12), padding: const EdgeInsets.all(16),
itemCount: _searchableList.length, itemBuilder: (context, index) {
padding: const EdgeInsets.all(16), return AssetItemGridView(
itemBuilder: (context, index) { device: _searchableList[index],
return AssetItemGridView( onPressed: (device) {
device: _searchableList[index], widget.fromBottomBar ? Navigator.of(context).pushNamed(AssetDetailPage.id, arguments: device.id) : Navigator.of(context).pop(device);
onPressed: (device) { },
widget.fromBottomBar ? Navigator.of(context).pushNamed(AssetDetailPage.id, arguments: device.id) : Navigator.of(context).pop(device); );
}, },
); ),
}, ),
), if (_devicesProvider.isLoading) Align(alignment: Alignment.bottomCenter, child: const CircularProgressIndicator().paddingOnly(top: 16, bottom: 16)),
],
), ),
)), )),
], ],

@ -171,6 +171,24 @@ class _AppTimerState extends State<AppTimer> {
showTimePicker( showTimePicker(
context: context, context: context,
initialTime: TimeOfDay.now(), initialTime: TimeOfDay.now(),
builder: (BuildContext context, Widget? child) {
final ThemeData currentTheme = Theme.of(context);
return Theme(
data: currentTheme.copyWith(
timePickerTheme: TimePickerThemeData(
dialHandColor: AppColor.primary10,
dialBackgroundColor: Colors.grey.withOpacity(0.1),
hourMinuteColor: MaterialStateColor.resolveWith((states) => states.contains(MaterialState.selected) ? AppColor.primary10 : Colors.grey.withOpacity(0.1)),
dayPeriodColor: MaterialStateColor.resolveWith((states) => states.contains(MaterialState.selected) ? AppColor.primary10 : Colors.transparent),
dayPeriodTextColor: MaterialStateColor.resolveWith((states) => states.contains(MaterialState.selected) ? Colors.white : AppColor.primary10),
dayPeriodBorderSide: BorderSide(color: Colors.grey.withOpacity(0.2)),
entryModeIconColor: AppColor.primary10,
),
textButtonTheme: TextButtonThemeData(style: TextButton.styleFrom(foregroundColor: AppColor.primary10)),
),
child: child!,
);
},
).then((selectedTime) { ).then((selectedTime) {
if (selectedTime != null) { if (selectedTime != null) {
_pickerStartAt = DateTime(selectedDate.year, selectedDate.month, selectedDate.day, selectedTime.hour, selectedTime.minute); _pickerStartAt = DateTime(selectedDate.year, selectedDate.month, selectedDate.day, selectedTime.hour, selectedTime.minute);
@ -205,6 +223,24 @@ class _AppTimerState extends State<AppTimer> {
showTimePicker( showTimePicker(
context: context, context: context,
initialTime: TimeOfDay.now(), initialTime: TimeOfDay.now(),
builder: (BuildContext context, Widget? child) {
final ThemeData currentTheme = Theme.of(context);
return Theme(
data: currentTheme.copyWith(
timePickerTheme: TimePickerThemeData(
dialHandColor: AppColor.primary10,
dialBackgroundColor: Colors.grey.withOpacity(0.1),
hourMinuteColor: MaterialStateColor.resolveWith((states) => states.contains(MaterialState.selected) ? AppColor.primary10 : Colors.grey.withOpacity(0.1)),
dayPeriodColor: MaterialStateColor.resolveWith((states) => states.contains(MaterialState.selected) ? AppColor.primary10 : Colors.transparent),
dayPeriodTextColor: MaterialStateColor.resolveWith((states) => states.contains(MaterialState.selected) ? Colors.white : AppColor.primary10),
dayPeriodBorderSide: BorderSide(color: Colors.grey.withOpacity(0.2)),
entryModeIconColor: AppColor.primary10,
),
textButtonTheme: TextButtonThemeData(style: TextButton.styleFrom(foregroundColor: AppColor.primary10)),
),
child: child!,
);
},
).then((selectedTime) { ).then((selectedTime) {
if (selectedTime != null) { if (selectedTime != null) {
selectedDate = selectedDate.add(Duration(hours: selectedTime.hour, minutes: selectedTime.minute)); selectedDate = selectedDate.add(Duration(hours: selectedTime.hour, minutes: selectedTime.minute));
@ -256,7 +292,7 @@ class _AppTimerState extends State<AppTimer> {
color: context.isDark && !widget.enabled color: context.isDark && !widget.enabled
? AppColor.neutral60 ? AppColor.neutral60
: !widget.enabled : !widget.enabled
// backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, // backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
? AppColor.neutral40 ? AppColor.neutral40
: AppColor.fieldBgColor(context), : AppColor.fieldBgColor(context),
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),

Loading…
Cancel
Save