import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class TimeLineView extends StatefulWidget { bool isLogged, isArabic; List appoitmentAllHistoryResultList; TimeLineView(this.isLogged, this.isArabic, this.appoitmentAllHistoryResultList); @override _TimeLineViewState createState() => _TimeLineViewState(); } class _TimeLineViewState extends State { @override Widget build(BuildContext context) { return Container( width: double.infinity, height: 210, decoration: containerBottomRightRadiusWithGradientBorder(0, darkColor: Color(0xFFF2B353E), lightColor: Color(0xFFF2B353E)), child: Column( crossAxisAlignment: CrossAxisAlignment.start, // mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ 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, ), ), ], ), ], ), ), 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, ), ), ], ), ); } } class TimelineNewWidget extends StatelessWidget { final AppoitmentAllHistoryResultList appoitmentAllHistoryResul; TimelineNewWidget({Key key, this.appoitmentAllHistoryResul}); @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return Container( width: MediaQuery.of(context).size.width / 1.6, child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ Container( width: double.infinity, child: Row( children: [ Text( DateUtil.getDayMonthYearLangDateFormatted( DateUtil.convertStringToDate(appoitmentAllHistoryResul.appointmentDate), projectViewModel.isArabic ? "ar" : "en", ), style: TextStyle( color: CustomColors.grey2, ), ), barView(), ], ), ), mHeight(10), LargeAvatar( onTap: () { //AppointmentDetails // Navigator.push( // context, // FadePage( // page: AppointmentDetails( // appo: appoitmentAllHistoryResul, // ))); }, name: appoitmentAllHistoryResul.doctorNameObj, url: appoitmentAllHistoryResul.doctorImageURL, width: 30, height: 30, ), mHeight(6), Text( appoitmentAllHistoryResul.doctorNameObj, style: TextStyle( color: CustomColors.white, fontSize: 14, ), ), Text( appoitmentAllHistoryResul.clinicName, style: TextStyle( color: CustomColors.grey2, fontSize: 10, fontWeight: FontWeight.bold, ), ), ], ), ); } Widget barView() { return Flexible( child: Container( width: double.infinity, child: Row( children: [ Container( width: 6, height: 6, decoration: containerColorRadiusBorderWidth(CustomColors.pharmacyGreyColor, 50, CustomColors.grey2, 1), ), Expanded( child: Container( width: double.infinity, height: 1, color: CustomColors.grey2, ), ), Container( width: 6, height: 6, decoration: containerColorRadiusBorderWidth(CustomColors.pharmacyGreyColor, 50, CustomColors.grey2, 1), ), ], ), ), ); } }