From a20185b2b9db87ddf2e3a88b1c869354883bd970 Mon Sep 17 00:00:00 2001 From: "Mirza.Shafique" Date: Sun, 8 Aug 2021 15:27:03 +0300 Subject: [PATCH] Home page 1.4 (Homepage changes) --- lib/main.dart | 5 +- .../landing/fragments/home_page_fragment.dart | 31 +++--- .../fragments/logged_home_page_fragment.dart | 99 ++++++------------- lib/pages/landing/landing_page.dart | 2 +- .../medical/medical_profile_page_new.dart | 40 ++++---- .../medical/time_line_new_widget.dart | 72 ++++++++------ .../others/floating_button_search.dart | 2 +- 7 files changed, 115 insertions(+), 136 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 70ca9d71..45fa4c6d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -51,7 +51,10 @@ class _MyApp extends State { LocalNotification.getInstance() .showNow(title: "Payload", subtitle: payload, payload: payload); }); - + SystemChrome.setPreferredOrientations([ + DeviceOrientation.portraitUp, + DeviceOrientation.portraitDown, + ]); // final themeNotifier = Provider.of(context); precacheImage(AssetImage('assets/images/powerd-by.jpg'), context); return LayoutBuilder( diff --git a/lib/pages/landing/fragments/home_page_fragment.dart b/lib/pages/landing/fragments/home_page_fragment.dart index 84be4256..b53e7a07 100644 --- a/lib/pages/landing/fragments/home_page_fragment.dart +++ b/lib/pages/landing/fragments/home_page_fragment.dart @@ -47,9 +47,9 @@ class _HomePageFragmentState extends State { child: Column( children: [ AspectRatio( - aspectRatio: 2, + aspectRatio: 2.2, child: Container( - margin: EdgeInsets.all(14), + margin: EdgeInsets.only(left: 14,right: 14,top: 10,bottom: 10), child: SliderView( onLoginClick: () { widget.onLoginClick(); @@ -62,7 +62,19 @@ class _HomePageFragmentState extends State { padding: const EdgeInsets.only(left: 20, right: 20), child: Image.asset("assets/images/bn_offer.png"), ), - mHeight(20), + Padding( + padding: const EdgeInsets.only( + left: 20, + right: 20, + top: 16, + ), + child: PharmacyView( + onPharmacyClick: () { + widget.onPharmacyClick(); + }, + ), + ), + mHeight(16), Column( children: [ Padding( @@ -116,18 +128,7 @@ class _HomePageFragmentState extends State { ), ], ), - Padding( - padding: const EdgeInsets.only( - left: 20, - right: 20, - top: 20, - ), - child: PharmacyView( - onPharmacyClick: () { - widget.onPharmacyClick(); - }, - ), - ), + mHeight(140), ], ), diff --git a/lib/pages/landing/fragments/logged_home_page_fragment.dart b/lib/pages/landing/fragments/logged_home_page_fragment.dart index 05822158..9f96f4a2 100644 --- a/lib/pages/landing/fragments/logged_home_page_fragment.dart +++ b/lib/pages/landing/fragments/logged_home_page_fragment.dart @@ -86,52 +86,23 @@ class _HomePageFragmentState extends State { width: double.infinity, child: Column( children: [ - FutureBuilder( - future: getFamilyFiles(), // async work - builder: (BuildContext context, AsyncSnapshot snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.waiting: - return Padding(padding: EdgeInsets.all(10), child: Text('')); - default: - if (snapshot.hasError) - return Padding(padding: EdgeInsets.all(10), child: Text(snapshot.error)); - else { - List sliderData = []; - sliderData.add(new SliderData(TranslationBase.of(context).fileno + ": " + widget.projectViewModel.user.patientID.toString(), - widget.projectViewModel.user.firstName + ' ' + widget.projectViewModel.user.lastName, "", bannerColor[0].darkColor, bannerColor[0].lightColor)); - for (int i = 0; i < snapshot.data.getAllSharedRecordsByStatusList.length; i++) { - if (snapshot.data.getAllSharedRecordsByStatusList[i].status == 3) - sliderData.add(new SliderData(TranslationBase.of(context).fileno + ": " + snapshot.data.getAllSharedRecordsByStatusList[i].responseID.toString(), - snapshot.data.getAllSharedRecordsByStatusList[i].patientName, "", bannerColor[i + 1].darkColor, bannerColor[i + 1].lightColor)); - } - - return AspectRatio( - aspectRatio: 2, - child: CarouselSlider( - options: CarouselOptions( - autoPlay: false, - enlargeCenterPage: true, - initialPage: 0, - aspectRatio: 2.5, - viewportFraction: 0.9, - enableInfiniteScroll: false, - onPageChanged: (index, reason) { - print("onPageChanged"); - }), - items: [ - for (int i = 0; i < sliderData.length; i++) - Builder( - builder: (BuildContext context) { - return LoggedSliderView(widget.projectViewModel, sliderData[i]); - }, - ) - ], - ), - ); - } - } - }, + AspectRatio( + aspectRatio: 2.2, + child: Padding( + padding: const EdgeInsets.only(left: 20,right: 20,top: 16,bottom: 16), + child: LoggedSliderView( + widget.projectViewModel, + new SliderData(TranslationBase.of(context).fileno + ": " + widget.projectViewModel.user.patientID.toString(), + widget.projectViewModel.user.firstName + ' ' + widget.projectViewModel.user.lastName, "", bannerColor[0].darkColor, bannerColor[0].lightColor)), + ), ), + appoCountProvider.count == 0 + ? Padding( + padding: const EdgeInsets.only(left: 20, right: 20), + child: Image.asset("assets/images/bn_offer.png"), + ) + : offersView(appoCountProvider.count), + mHeight(16), Container( width: double.infinity, height: MediaQuery.of(context).size.height * 0.143, @@ -161,19 +132,19 @@ class _HomePageFragmentState extends State { ? EdgeInsets.only( right: 20, left: 8, - top: 4, + top: 0, ) : EdgeInsets.only( left: 20, right: 8, - top: 4, + top: 0, ), child: Row( children: [ mFlex(1), FlatButton( onPressed: () { - navigateTo(context, MedicalProfilePage()); + navigateTo(context, MedicalProfilePageNew()); }, child: Text( TranslationBase.of(context).viewMedicalFile, @@ -187,14 +158,18 @@ class _HomePageFragmentState extends State { ], ), ), - mHeight(4), - appoCountProvider.count == 0 - ? Padding( - padding: const EdgeInsets.only(left: 20, right: 20), - child: Image.asset("assets/images/bn_offer.png"), - ) - : offersView(appoCountProvider.count), - mHeight(14), + Padding( + padding: const EdgeInsets.only( + left: 20, + right: 20, + top: 4, + ), + child: PharmacyView( + onPharmacyClick: () { + widget.onPharmacyClick(); + }, + ), + ), Column( children: [ Padding( @@ -262,18 +237,6 @@ class _HomePageFragmentState extends State { ), ], ), - Padding( - padding: const EdgeInsets.only( - left: 20, - right: 20, - top: 20, - ), - child: PharmacyView( - onPharmacyClick: () { - widget.onPharmacyClick(); - }, - ), - ), mHeight(140), ], ), diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index fc412328..655ce01d 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -517,7 +517,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { login(); }, ), - MedicalProfilePage(), + MedicalProfilePageNew(), BookingOptions(), MyFamily(isAppbarVisible: false), ToDo(isShowAppBar: false), diff --git a/lib/pages/medical/medical_profile_page_new.dart b/lib/pages/medical/medical_profile_page_new.dart index 285dd704..6875debc 100644 --- a/lib/pages/medical/medical_profile_page_new.dart +++ b/lib/pages/medical/medical_profile_page_new.dart @@ -76,26 +76,26 @@ class _MedicalProfilePageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: double.infinity, - height: 210, - decoration: containerBottomRightRadiusWithGradientBorder(0, darkColor: Color(0xFFF2B353E), lightColor: Color(0xFFF2B353E)), - child: Stack( - children: [ - if (model.isLogin) - ListView.builder( - itemBuilder: (context, index) => TimeLineWidget( - isUp: index % 2 == 1, - appoitmentAllHistoryResul: model.appoitmentAllHistoryResultList[index], - ), - itemCount: model.appoitmentAllHistoryResultList.length, - scrollDirection: Axis.horizontal, - reverse: projectViewModel.isArabic, - ), - ], - ), - ), - TimeLineView(model.isLogin, projectViewModel.isArabic, model.appoitmentAllHistoryResultList), + // Container( + // width: double.infinity, + // height: 210, + // decoration: containerBottomRightRadiusWithGradientBorder(0, darkColor: Color(0xFFF2B353E), lightColor: Color(0xFFF2B353E)), + // child: Stack( + // children: [ + // if (model.isLogin) + // ListView.builder( + // itemBuilder: (context, index) => TimeLineWidget( + // isUp: index % 2 == 1, + // appoitmentAllHistoryResul: model.appoitmentAllHistoryResultList[index], + // ), + // itemCount: model.appoitmentAllHistoryResultList.length, + // scrollDirection: Axis.horizontal, + // reverse: projectViewModel.isArabic, + // ), + // ], + // ), + // ), + //TimeLineView(model.isLogin, projectViewModel.isArabic, model.appoitmentAllHistoryResultList), SizedBox( height: 20, ), diff --git a/lib/widgets/data_display/medical/time_line_new_widget.dart b/lib/widgets/data_display/medical/time_line_new_widget.dart index d13d5d24..0452c5b6 100644 --- a/lib/widgets/data_display/medical/time_line_new_widget.dart +++ b/lib/widgets/data_display/medical/time_line_new_widget.dart @@ -28,40 +28,51 @@ class _TimeLineViewState extends State { crossAxisAlignment: CrossAxisAlignment.start, // mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - Row( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "Appointments", - style: TextStyle( - color: CustomColors.white, - fontSize: 14, - fontWeight: FontWeight.bold, + mFlex(2), + Padding( + padding: EdgeInsets.only(left: 12, right: 12), + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Appointments", + style: TextStyle( + color: CustomColors.white, + fontSize: 14, + fontWeight: FontWeight.bold, + ), ), - ), - Text( - "Timeline", - style: TextStyle( - color: CustomColors.white, - fontSize: 24, - fontWeight: FontWeight.bold, + Text( + "Timeline", + style: TextStyle( + color: CustomColors.white, + fontSize: 24, + fontWeight: FontWeight.bold, + ), ), - ), - ], - ), - ], + ], + ), + ], + ), ), - ListView.builder( - itemBuilder: (context, index) => TimelineNewWidget( - // isUp: index % 2 == 1, - appoitmentAllHistoryResul: widget.appoitmentAllHistoryResultList[index], + mFlex(1), + Container( + height: 110, + width: double.infinity, + child: ListView.builder( + itemBuilder: (context, index) => Padding( + padding: EdgeInsets.only(left: index==0?12:0,right: (widget.appoitmentAllHistoryResultList.length-1) != null?20:0), + child: TimelineNewWidget( + appoitmentAllHistoryResul: widget.appoitmentAllHistoryResultList[index], + ), + ), + itemCount: widget.appoitmentAllHistoryResultList.length, + scrollDirection: Axis.horizontal, + shrinkWrap: false, + reverse: widget.isArabic, ), - itemCount: widget.appoitmentAllHistoryResultList.length, - scrollDirection: Axis.horizontal, - shrinkWrap: true, - reverse: widget.isArabic, ), ], ), @@ -81,6 +92,7 @@ class TimelineNewWidget extends StatelessWidget { width: MediaQuery.of(context).size.width / 1.6, child: Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ Container( width: double.infinity, diff --git a/lib/widgets/others/floating_button_search.dart b/lib/widgets/others/floating_button_search.dart index d8ca7a92..f881fb29 100644 --- a/lib/widgets/others/floating_button_search.dart +++ b/lib/widgets/others/floating_button_search.dart @@ -454,7 +454,7 @@ class _FloatingSearchButton extends State with TickerProvi break; case '17': { - Navigator.push(context, FadePage(page: MedicalProfilePage())); + Navigator.push(context, FadePage(page: MedicalProfilePageNew())); } break; case '18':