@ -1,15 +1,23 @@
import ' package:auto_size_text/auto_size_text.dart ' ;
import ' package:diplomaticquarterapp/config/config.dart ' ;
import ' package:diplomaticquarterapp/config/shared_pref_kay.dart ' ;
import ' package:diplomaticquarterapp/core/viewModels/project_view_model.dart ' ;
import ' package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart ' ;
import ' package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart ' ;
import ' package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart ' ;
import ' package:diplomaticquarterapp/pages/base/base_view.dart ' ;
import ' package:diplomaticquarterapp/routes.dart ' ;
import ' package:diplomaticquarterapp/theme/colors.dart ' ;
import ' package:diplomaticquarterapp/uitl/date_uitl.dart ' ;
import ' package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart ' ;
import ' package:diplomaticquarterapp/uitl/translations_delegate_base.dart ' ;
import ' package:diplomaticquarterapp/uitl/utils_new.dart ' ;
import ' package:diplomaticquarterapp/widgets/avatar/large_avatar.dart ' ;
import ' package:diplomaticquarterapp/widgets/data_display/list/flexible_container.dart ' ;
import ' package:diplomaticquarterapp/widgets/transitions/fade_page.dart ' ;
import ' package:equatable/equatable.dart ' ;
import ' package:flutter/material.dart ' ;
import ' package:flutter_svg/flutter_svg.dart ' ;
import ' package:provider/provider.dart ' ;
class TimeLineView extends StatefulWidget {
@ -76,107 +84,191 @@ class _TimeLineViewState extends State<TimeLineView> {
width: double . infinity ,
height: 210 ,
decoration: containerBottomRightRadiusWithGradientBorder ( 0 , darkColor: Color ( 0xFFF2B353E ) , lightColor: Color ( 0xFFF2B353E ) ) ,
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
/ / mainAxisAlignment: MainAxisAlignment . spaceEvenly ,
children: [
widget . isLogged ? mFlex ( 2 ) : mHeight ( 12 ) ,
Padding (
padding: EdgeInsets . only ( left: 12 , right: 12 ) ,
child: Row (
child: widget . isLogged & & tempList . length > 0
? Column (
crossAxisAlignment: CrossAxisAlignment . start ,
/ / mainAxisAlignment: MainAxisAlignment . spaceEvenly ,
children: [
Expanded (
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
mFlex ( 2 ) ,
Padding (
padding: EdgeInsets . only ( left: 12 , right: 12 ) ,
child: Row (
children: [
Text (
TranslationBase . of ( context ) . appointments ,
style: TextStyle (
color: CustomColors . white ,
fontSize: 14 ,
fontWeight: FontWeight . bold ,
) ,
) ,
Text (
TranslationBase . of ( context ) . timeLine ,
style: TextStyle (
color: CustomColors . white ,
fontSize: 24 ,
fontWeight: FontWeight . bold ,
Expanded (
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
Text (
TranslationBase . of ( context ) . appointments ,
style: TextStyle (
color: CustomColors . white ,
fontSize: 14 ,
fontWeight: FontWeight . bold ,
) ,
) ,
Text (
TranslationBase . of ( context ) . timeLine ,
style: TextStyle (
color: CustomColors . white ,
fontSize: 24 ,
fontWeight: FontWeight . bold ,
) ,
) ,
] ,
) ,
) ,
widget . isLogged
? Container (
decoration: containerRadius ( Color ( 0xFF2B2E31 ) , 100 ) ,
height: 30 ,
child: DropdownButtonHideUnderline (
child: ButtonTheme (
alignedDropdown: true ,
child: DropdownButton < DateObj > (
hint: Text (
TranslationBase . of ( context ) . all ,
style: TextStyle ( color: CustomColors . grey2 , fontSize: 10 ) ,
) ,
iconEnabledColor: CustomColors . grey2 ,
style: TextStyle ( color: CustomColors . grey2 , fontSize: 10 ) ,
dropdownColor: Color ( 0xFF2B2E31 ) ,
value: selectedDateObj ,
items: dateObjs . map ( ( DateObj value ) {
return DropdownMenuItem < DateObj > (
value: value ,
child: new AutoSizeText (
value . monthYear ,
) ,
) ;
} ) . toList ( ) ,
onChanged: ( r ) {
selectedDateObj = r ;
applyFilter ( r . year = = 0 ? true : false ) ;
setState ( ( ) { } ) ;
} ,
underline: Container (
height: 0 ,
) ,
) ,
) ,
) ,
)
: Container ( )
] ,
) ,
) ,
mFlex ( 1 ) ,
widget . isLogged
? Container (
decoration: containerRadius ( Color ( 0xFF2B2E31 ) , 100 ) ,
height: 30 ,
child: DropdownButtonHideUnderline (
child: ButtonTheme (
alignedDropdown: true ,
child: DropdownButton < DateObj > (
hint: Text (
TranslationBase . of ( context ) . all ,
style: TextStyle ( color: CustomColors . grey2 , fontSize: 10 ) ,
) ,
iconEnabledColor: CustomColors . grey2 ,
style: TextStyle ( color: CustomColors . grey2 , fontSize: 10 ) ,
dropdownColor: Color ( 0xFF2B2E31 ) ,
value: selectedDateObj ,
items: dateObjs . map ( ( DateObj value ) {
return DropdownMenuItem < DateObj > (
value: value ,
child: new AutoSizeText (
value . monthYear ,
) ,
) ;
} ) . toList ( ) ,
onChanged: ( r ) {
selectedDateObj = r ;
applyFilter ( r . year = = 0 ? true : false ) ;
setState ( ( ) { } ) ;
} ,
underline: Container (
height: 0 ,
) ,
height: widget . isArabic ? 130 : 110 ,
width: double . infinity ,
child: ListView . separated (
itemBuilder: ( context , index ) = > Padding (
padding: widget . isArabic
? EdgeInsets . only ( left: index = = 0 ? 0 : 12 , right: ( tempList . length - 1 ) = = index ? 0 : 12 )
: EdgeInsets . only ( left: index = = 0 ? 12 : 0 , right: ( tempList . length - 1 ) = = index ? 12 : 0 ) ,
child: TimelineNewWidget (
appoitmentAllHistoryResul: tempList [ index ] ,
isLast: tempList . length - 1 = = index ? true : false ,
) ,
) ,
itemCount: tempList . length ,
scrollDirection: Axis . horizontal ,
shrinkWrap: false ,
physics: BouncingScrollPhysics ( ) ,
separatorBuilder: ( BuildContext context , int index ) {
return mWidth ( 8 ) ;
} ,
) ,
)
: Container ( )
: Container ( ) ,
] ,
) ,
) ,
mFlex ( 1 ) ,
widget . isLogged
? Container (
height: widget . isArabic ? 130 : 110 ,
width: double . infinity ,
child: ListView . separated (
itemBuilder: ( context , index ) = > Padding (
padding: widget . isArabic
? EdgeInsets . only ( left: index = = 0 ? 0 : 12 , right: ( tempList . length - 1 ) = = index ? 0 : 12 )
: EdgeInsets . only ( left: index = = 0 ? 12 : 0 , right: ( tempList . length - 1 ) = = index ? 12 : 0 ) ,
child: TimelineNewWidget (
appoitmentAllHistoryResul: tempList [ index ] ,
isLast: tempList . length - 1 = = index ? true : false ,
)
: emptyView ( widget . isLogged ) ,
) ;
}
Widget emptyView ( bool isLogged ) {
return Padding (
padding: const EdgeInsets . all ( 12.0 ) ,
child: Row (
children: [
Flexible (
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
mFlex ( 2 ) ,
Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
Text (
TranslationBase . of ( context ) . appointments ,
style: TextStyle (
color: CustomColors . white ,
fontSize: 14 ,
fontWeight: FontWeight . bold ,
) ,
) ,
itemCount: tempList . length ,
scrollDirection: Axis . horizontal ,
shrinkWrap: false ,
physics: BouncingScrollPhysics ( ) ,
separatorBuilder: ( BuildContext context , int index ) {
return mWidth ( 8 ) ;
} ,
Text (
TranslationBase . of ( context ) . timeLine ,
style: TextStyle (
color: CustomColors . white ,
fontSize: 24 ,
fontWeight: FontWeight . bold ,
) ,
) ,
] ,
) ,
mFlex ( 1 ) ,
Text (
isLogged ? TranslationBase . of ( context ) . noAppointmentAvailable : TranslationBase . of ( context ) . cantSeeProfile ,
style: TextStyle (
color: Colors . white ,
fontWeight: FontWeight . bold ,
fontSize: 14 ,
) ,
)
: Container ( ) ,
) ,
mHeight ( 4 ) ,
! isLogged
? Container (
height: MediaQuery . of ( context ) . size . width / 14 ,
width: MediaQuery . of ( context ) . size . width / ( widget . isArabic ? 4 : 6 ) ,
child: RaisedButton (
shape: cardRadius ( 8 ) ,
color: Color ( 0xFFFBF2E31 ) ,
padding: EdgeInsets . zero ,
onPressed: ( ) {
/ / onLoginClick ( ) ;
login ( ) ;
} ,
child: Center (
child: AutoSizeText (
TranslationBase . of ( context ) . login ,
maxLines: 1 ,
style: TextStyle ( color: Colors . white , fontSize: 14 ) ,
) ,
) ,
) ,
)
: Container (
height: MediaQuery . of ( context ) . size . width / 14 ,
) ,
mFlex ( 3 ) ,
] ,
) ,
) ,
SvgPicture . asset ( " assets/images/new/empty.svg " ) ,
mWidth ( 20 ) ,
] ,
) ,
) ;
}
login ( ) async {
Navigator . of ( context ) . pushNamed (
WELCOME_LOGIN ,
) ;
}
}
class TimelineNewWidget extends StatelessWidget {