From 66034a6424c0a717a668f766b720f706a28f5fa1 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 9 Nov 2023 11:11:29 +0300 Subject: [PATCH] improvements --- .../calender_fragments/monthly_fragment.dart | 1 + .../pages/land_page/calender_page12.dart | 145 ------------------ .../equipment/asset_item_listview.dart | 142 ++++++++--------- 3 files changed, 67 insertions(+), 221 deletions(-) delete mode 100644 lib/new_views/pages/land_page/calender_page12.dart diff --git a/lib/new_views/pages/land_page/calender_fragments/monthly_fragment.dart b/lib/new_views/pages/land_page/calender_fragments/monthly_fragment.dart index 64323c4d..a06d31b2 100644 --- a/lib/new_views/pages/land_page/calender_fragments/monthly_fragment.dart +++ b/lib/new_views/pages/land_page/calender_fragments/monthly_fragment.dart @@ -32,6 +32,7 @@ class _MonthlyFragmentState extends State { focusedDay: DateTime.now(), calendarFormat: CalendarFormat.month, weekendDays: const [], + rowHeight: 45, availableGestures: AvailableGestures.none, onCalendarCreated: (controller) { _controller = controller; diff --git a/lib/new_views/pages/land_page/calender_page12.dart b/lib/new_views/pages/land_page/calender_page12.dart deleted file mode 100644 index 812f7e5a..00000000 --- a/lib/new_views/pages/land_page/calender_page12.dart +++ /dev/null @@ -1,145 +0,0 @@ -// import 'package:flutter/material.dart'; -// import 'package:table_calendar/table_calendar.dart'; -// import 'package:test_sa/extensions/int_extensions.dart'; -// import 'package:test_sa/extensions/text_extensions.dart'; -// import 'package:test_sa/extensions/widget_extensions.dart'; -// import 'package:test_sa/new_views/app_style/app_color.dart'; -// import 'package:test_sa/new_views/pages/land_page/calender_fragments/monthly_fragment.dart'; -// import 'package:test_sa/new_views/pages/land_page/calender_fragments/weekly_fragment.dart'; -// -// class CalenderPage extends StatefulWidget { -// CalenderPage({Key key}) : super(key: key); -// -// @override -// _CalenderPageState createState() { -// return _CalenderPageState(); -// } -// } -// -// class _CalenderPageState extends State { -// int selectedIndex = 0; -// DateTime currentDateTime = DateTime.now(); -// -// PageController _pageController; -// -// @override -// void initState() { -// _pageController = PageController(); -// super.initState(); -// } -// -// @override -// void dispose() { -// _pageController.dispose(); -// super.dispose(); -// } -// -// @override -// Widget build(BuildContext context) { -// return Scaffold( -// body: Column( -// children: [ -// // todo @sikander, hiding My shift view, later when they add data, then will us it. -// Container( -// width: double.infinity, -// padding: const EdgeInsets.all(16), -// decoration: ShapeDecoration( -// color: Colors.white, -// shape: RoundedRectangleBorder( -// borderRadius: BorderRadius.circular(20), -// ), -// shadows: const [ -// BoxShadow( -// color: Color(0x07000000), -// blurRadius: 14, -// offset: Offset(0, 0), -// spreadRadius: 0, -// ) -// ], -// ), -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// mainAxisSize: MainAxisSize.min, -// children: [ -// Text( -// 'My Shift', -// style: AppTextStyles.heading5.copyWith(color: AppColor.neutral50), -// ), -// 8.height, -// Text( -// 'Sunday to Thursday', -// style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF757575)), -// ), -// Text( -// '09:00 to 18:00', -// style: AppTextStyles.bodyText.copyWith(color: AppColor.neutral50), -// ), -// ], -// ), -// ), -// -// Container( -// width: double.infinity, -// padding: const EdgeInsets.all(4), -// decoration: ShapeDecoration( -// color: const Color(0xFFEAF1F4), -// shape: RoundedRectangleBorder( -// borderRadius: BorderRadius.circular(16), -// ), -// shadows: const [ -// BoxShadow( -// color: Color(0x07000000), -// blurRadius: 14, -// offset: Offset(0, 0), -// spreadRadius: 0, -// ) -// ], -// ), -// child: Row( -// children: [ -// tabItem("Monthly", 0, selectedIndex, () => onTabPress(0)), -// tabItem("Weekly", 1, selectedIndex, () => onTabPress(1)), -// tabItem("Daily", 2, selectedIndex, () => onTabPress(2)), -// ], -// ), -// ), -// 8.height, -// PageView( -// controller: _pageController, -// onPageChanged: (index) => onTabPress(index), -// children: [ -// MonthlyFragment(), -// WeeklyFragment(), -// Container(), -// ], -// ).expanded, -// ], -// ), -// ); -// } -// -// void onTabPress(index) { -// if (selectedIndex != index) { -// setState(() { -// selectedIndex = index; -// }); -// _pageController.jumpToPage(index); -// } -// } -// -// Widget tabItem(String title, int index, int selectedIndex, VoidCallback onPress) { -// return Container( -// alignment: Alignment.center, -// padding: const EdgeInsets.only(top: 14, bottom: 14), -// decoration: ShapeDecoration( -// color: index == selectedIndex ? Colors.white : Colors.transparent, -// shape: RoundedRectangleBorder( -// borderRadius: BorderRadius.circular(13), -// ), -// ), -// child: Text( -// title, -// style: AppTextStyles.bodyText.copyWith(color: index == selectedIndex ? AppColor.neutral60 : const Color(0xFF757575)), -// )).onPress(onPress).expanded; -// } -// } diff --git a/lib/views/widgets/equipment/asset_item_listview.dart b/lib/views/widgets/equipment/asset_item_listview.dart index d6cf6fc7..4023e0d7 100644 --- a/lib/views/widgets/equipment/asset_item_listview.dart +++ b/lib/views/widgets/equipment/asset_item_listview.dart @@ -14,83 +14,73 @@ class AssetItemListView extends StatelessWidget { @override Widget build(BuildContext context) { - return Container( - padding: const EdgeInsets.all(16), - decoration: ShapeDecoration( - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(20), + return Row( + children: [ + Container( + width: 95, + height: 95, + decoration: ShapeDecoration( + color: const Color(0xFFEAF1F4), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + image: DecorationImage( + fit: BoxFit.cover, + image: NetworkImage(device.assetPhoto != null ? URLs.getFileUrl(device.assetPhoto) : "https://www.lasteelcraft.com/images/no-image-available.png"), + )), ), - shadows: const [BoxShadow(color: Color(0x07000000), blurRadius: 14, offset: Offset(0, 0), spreadRadius: 0)], - ), - child: Row( - children: [ - Container( - width: 95, - height: 95, - decoration: ShapeDecoration( - color: const Color(0xFFEAF1F4), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + 15.width, + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + device.modelDefinition.assetName, + maxLines: 2, + style: AppTextStyles.heading5.copyWith(color: Color(0xFF3B3D4A)), ), - image: DecorationImage( - fit: BoxFit.cover, - image: NetworkImage(device.assetPhoto != null ? URLs.getFileUrl(device.assetPhoto) : "https://www.lasteelcraft.com/images/no-image-available.png"), - )), - ), - 15.width, - Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - device.modelDefinition.assetName, - maxLines: 2, - style: AppTextStyles.heading5.copyWith(color: Color(0xFF3B3D4A)), - ), - Text( - "${context.translation.assetNumber} : ${device.assetNumber}", - style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)), - ), - Text( - "${context.translation.model} : ${device.modelDefinition.modelDefCode}", - style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)), - ), - ], - ), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - "${context.translation.serialNo} : ${device.assetSerialNo}", - maxLines: 2, - style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)), - ).expanded, - Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - context.translation.viewDetails, - style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF4A8DB7)), - ), - 4.width, - const Icon( - Icons.arrow_forward, - color: Color(0xFF4A8DB7), - size: 14, - ) - ], - ), - ], - ) - ], - ).expanded - ], - ), - ).onPress(() => onPressed(device)); + Text( + "${context.translation.assetNumber} : ${device.assetNumber}", + style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)), + ), + Text( + "${context.translation.model} : ${device.modelDefinition.modelDefCode}", + style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)), + ), + ], + ), + Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + "${context.translation.serialNo} : ${device.assetSerialNo}", + maxLines: 2, + style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)), + ).expanded, + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + context.translation.viewDetails, + style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF4A8DB7)), + ), + 4.width, + const Icon( + Icons.arrow_forward, + color: Color(0xFF4A8DB7), + size: 14, + ) + ], + ), + ], + ) + ], + ).expanded + ], + ).toShadowContainer(context).onPress(() => onPressed(device)); } }