From d3e27eab6fde1b41494f5df90bb3bf516c51e5cc Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 13 Apr 2020 12:28:51 +0300 Subject: [PATCH] finish my schedule --- lib/screens/my_schedule_screen.dart | 71 ++---------------- .../shared/rounded_container_widget.dart | 6 +- lib/widgets/shared/schedule_item_widget.dart | 72 +++++++++++++++++++ 3 files changed, 82 insertions(+), 67 deletions(-) create mode 100644 lib/widgets/shared/schedule_item_widget.dart diff --git a/lib/screens/my_schedule_screen.dart b/lib/screens/my_schedule_screen.dart index 29393b18..4e430d69 100644 --- a/lib/screens/my_schedule_screen.dart +++ b/lib/screens/my_schedule_screen.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/schedule_item_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -34,7 +35,7 @@ class MyScheduleScreen extends StatelessWidget { SizedBox( height: 20, ), - Text('My Schedule', style: textStyle(3, FontWeight.w700)), + Text('My Schedule', style: textStyle(2.5, FontWeight.w700)), scheduleListByDate('Today, 7 April '), scheduleListByDate('Wednesday, 8 April '), ], @@ -52,11 +53,12 @@ class MyScheduleScreen extends StatelessWidget { SizedBox( height: 10, ), - Text(date, style: textStyle(3)), + Text(date, style: textStyle(2.5)), Container( child: Column( children: litems.map((item) { - return ScheduleItemWidget(); + return ScheduleItemWidget('ER new development ideas meeting', + '09:00 AM - 10:50 AM ', 'Cloud Solution'); }).toList(), ), ), @@ -70,66 +72,3 @@ class MyScheduleScreen extends StatelessWidget { } } -class ScheduleItemWidget extends StatelessWidget { - const ScheduleItemWidget({ - Key key, - }) : super(key: key); - - @override - Widget build(BuildContext context) { - return Stack( - children: [ - RoundedContainer( - Container( - height: SizeConfig.screenHeight * 0.22, - width: SizeConfig.screenWidth * 0.95, - decoration: BoxDecoration(border: ), - // decoration: DoxD, - ), - backgroundColor: Colors.red, - showBorder: true, - borderColor: Hexcolor('#707070'), - ), - Positioned( - left: 10, - child: RoundedContainer( - Container( - padding: const EdgeInsets.all(15.0), - height: SizeConfig.screenHeight * 0.22, - width: SizeConfig.screenWidth * 0.92, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text('ER new development ideas meeting ', - style: textStyle(3)), - SizedBox( - height: 8, - ), - Text('09:00 AM - 10:50 AM ', style: textStyle(3)), - SizedBox( - height: 8, - ), - Row( - children: [ - Icon(Icons.add_location), - Text('Cloud Solution ', style: textStyle(3)) - ], - ) - ], - ), - ), - elevation: 20, - raduis: 0, - showBorder: true, - borderColor: Hexcolor('#707070'), - ), - ), - ], - ); - } - - TextStyle textStyle(size, [FontWeight weight]) { - return TextStyle( - fontSize: size * SizeConfig.textMultiplier, fontWeight: weight); - } -} diff --git a/lib/widgets/shared/rounded_container_widget.dart b/lib/widgets/shared/rounded_container_widget.dart index 1ce9fc53..8b071cf9 100644 --- a/lib/widgets/shared/rounded_container_widget.dart +++ b/lib/widgets/shared/rounded_container_widget.dart @@ -17,6 +17,7 @@ class RoundedContainer extends StatefulWidget { final double topRight; final double bottomLeft; final Widget widget; + final double borderWidth; RoundedContainer( this.widget, @@ -31,6 +32,7 @@ class RoundedContainer extends StatefulWidget { this.topRight = 0, this.bottomRight = 0, this.bottomLeft = 0, + this.borderWidth =1 }); @override @@ -41,11 +43,13 @@ class _RoundedContainerState extends State { @override Widget build(BuildContext context) { return Container( + height: null, + width: null, margin: EdgeInsets.all(widget.margin), decoration: widget.showBorder == true ? BoxDecoration( color: Theme.of(context).primaryColor, - border: Border.all(color: Colors.red, width: 1), + border: Border.all(color: widget.borderColor, width: widget.borderWidth), borderRadius: widget.customCornerRaduis ? BorderRadius.only( topLeft: Radius.circular(widget.topLeft), diff --git a/lib/widgets/shared/schedule_item_widget.dart b/lib/widgets/shared/schedule_item_widget.dart new file mode 100644 index 00000000..d74c84e3 --- /dev/null +++ b/lib/widgets/shared/schedule_item_widget.dart @@ -0,0 +1,72 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +class ScheduleItemWidget extends StatelessWidget { + String title; + String date; + String location; + ScheduleItemWidget(this.title, this.date, this.location); + + @override + Widget build(BuildContext context) { + return Stack( + children: [ + RoundedContainer( + Container( + height: SizeConfig.screenHeight * 0.20, + width: SizeConfig.screenWidth * 0.80, + ), + raduis: 10, + backgroundColor: Hexcolor('#58434F'), + showBorder: true, + borderColor: Hexcolor('#707070'), + borderWidth: 0.5, + ), + Positioned( + left: 10, + child: RoundedContainer( + Container( + padding: const EdgeInsets.all(15.0), + height: SizeConfig.screenHeight * 0.20, + width: SizeConfig.screenWidth * 0.80, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(title, style: textStyle(2.5)), + SizedBox( + height: 8, + ), + Text(date, style: textStyle(2.5)), + SizedBox( + height: 8, + ), + Row( + children: [ + Icon(Icons.add_location), + Text(location, style: textStyle(2.5)) + ], + ) + ], + ), + ), + elevation: 20, + // raduis: 0, + showBorder: true, + borderColor: Hexcolor('#707070'), + customCornerRaduis: true, + bottomLeft: 0, + topLeft: 0, + bottomRight: 10, + topRight: 10, + borderWidth: 0.5), + ), + ], + ); + } + + TextStyle textStyle(size, [FontWeight weight]) { + return TextStyle( + fontSize: size * SizeConfig.textMultiplier, fontWeight: weight); + } +}