add curve background to all screen

merge-requests/9/head
Elham Rababah 6 years ago
parent 709d75a310
commit f3164f693e

@ -12,7 +12,7 @@ import './screens/patients/patient_search_screen.dart';
import './screens/patients/patients_screen.dart'; import './screens/patients/patients_screen.dart';
import './screens/settings/settings_screen.dart'; import './screens/settings/settings_screen.dart';
const String INIT_ROUTE = PATIENTS; const String INIT_ROUTE = LOGIN;
const String HOME = '/'; const String HOME = '/';
const String LOGIN = 'login'; const String LOGIN = 'login';
const String CHANGE_PASSWORD = 'change-password'; const String CHANGE_PASSWORD = 'change-password';

@ -23,13 +23,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
return AppScaffold( return AppScaffold(
appBarTitle:'Home', appBarTitle:'Home',
body: Container( body: Container(
decoration: new BoxDecoration(
gradient: LinearGradient(
colors: [Colors.red[100], Colors.white],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(

@ -16,13 +16,6 @@ class MyScheduleScreen extends StatelessWidget {
// pageOnly: false, // pageOnly: false,
appBarTitle: 'My Schdule', appBarTitle: 'My Schdule',
body: Container( body: Container(
decoration: new BoxDecoration(
gradient: LinearGradient(
colors: [Colors.red[100], Colors.white],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0),
child: ListView(children: <Widget>[ child: ListView(children: <Widget>[
Column( Column(

@ -1,7 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import '../../config/size_config.dart';
import '../../widgets/shared/app_scaffold_widget.dart'; import '../../widgets/shared/app_scaffold_widget.dart';
import '../../widgets/shared/card_with_bg_widget.dart'; import '../../widgets/shared/card_with_bg_widget.dart';
@ -14,36 +12,21 @@ class PatientsScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return AppScaffold(
// pageOnly: false, appBarTitle: 'Patients',
appBarTitle: 'Patients', body: Container(
body: Stack( child: Column(
children: <Widget>[ children: litems.map((item) {
ClipPath( return CardWithBgWidget(
clipper: CustomShapeClipper(), line1Text: 'Fahad AlSlehm - 324599',
child: Container( line2Text: '12/04/2020 - 02:00 PM',
height: SizeConfig.realScreenHeight * 0.40, // line3Text: '',
decoration: BoxDecoration(color: Hexcolor('#FFDDD9')))),
Positioned( heightPercentage: 0.15,
// key: , widthPercentage: 0.80);
// top: SizeConfig.realScreenHeight * 0.10, }).toList(),
child: Container( ),
// decoration: BoxDecoration(color: Colors.red), ),
// margin: EdgeInsets.symmetric(vertical: 500), );
child: Column(
children: litems.map((item) {
return CardWithBgWidget(
line1Text: 'Fahad AlSlehm - 324599',
line2Text: '12/04/2020 - 02:00 PM',
// line3Text: '',
heightPercentage: 0.15,
widthPercentage: 0.80);
}).toList(),
),
),
)
],
));
} }
} }

@ -1,3 +1,5 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/screens/patients/patients_screen.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import '../../presentation/doctor_app_icons.dart'; import '../../presentation/doctor_app_icons.dart';
@ -5,69 +7,98 @@ import '../../widgets/shared/app_drawer_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class AppScaffold extends StatelessWidget { class AppScaffold extends StatelessWidget {
AppScaffold(
{this.pageOnly,
this.appBarTitle,
this.showAppBar,
this.showBottomBar,
this.showAppDrawer,
this.body});
bool pageOnly = false; bool pageOnly = false;
// bool showAll = // bool showAll =
bool showAppBar = true; bool showAppBar = true;
bool showAppDrawer = true; bool showAppDrawer = true;
bool showBottomBar = true; bool showBottomBar = true;
String appBarTitle=''; bool showbg = true;
bool showCurve = true;
String appBarTitle = '';
Widget body; Widget body;
AppScaffold(
{this.pageOnly,
this.appBarTitle,
this.showAppBar,
this.showBottomBar,
this.showAppDrawer,
this.body,
this.showbg,
this.showCurve});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: Hexcolor('#FCF7F7'), backgroundColor:
appBar: (pageOnly == true || showAppBar == false)?null:AppBar( (pageOnly == true || showbg == false) ? null : Hexcolor('#FCF7F7'),
appBar: (pageOnly == true || showAppBar == false)
elevation: 0, ? null
backgroundColor: Hexcolor('#FFDDD9'), : AppBar(
textTheme: TextTheme( elevation: 0,
title: TextStyle(color: Colors.black, fontWeight: FontWeight.bold)), backgroundColor: Hexcolor('#FFDDD9'),
title: Text(appBarTitle), textTheme: TextTheme(
leading: Builder(builder: (BuildContext context) { title: TextStyle(
return new GestureDetector( color: Colors.black, fontWeight: FontWeight.bold)),
onTap: () { title: Text(appBarTitle),
Scaffold.of(context).openDrawer(); leading: Builder(builder: (BuildContext context) {
}, return new GestureDetector(
child: IconButton( onTap: () {
icon: Icon(Icons.menu), Scaffold.of(context).openDrawer();
color: Colors.black, },
onPressed: () => Scaffold.of(context).openDrawer(), child: IconButton(
), icon: Icon(Icons.menu),
); color: Colors.black,
}), onPressed: () => Scaffold.of(context).openDrawer(),
centerTitle: true, ),
actions: <Widget>[ );
IconButton(icon: Icon(Icons.person), onPressed: null) }),
], centerTitle: true,
), actions: <Widget>[
drawer: (pageOnly == true || showAppDrawer == false)?null:Theme( IconButton(icon: Icon(Icons.person), onPressed: null)
data: Theme.of(context).copyWith( ],
canvasColor: Colors.transparent, ),
), drawer: (pageOnly == true || showAppDrawer == false)
child: SafeArea(child: AppDrawer()), ? null
), : Theme(
// , data: Theme.of(context).copyWith(
bottomNavigationBar: (pageOnly == true || showBottomBar == false)?null: BottomNavigationBar(items: [ canvasColor: Colors.transparent,
BottomNavigationBarItem( ),
icon: Icon(DoctorApp.home_icon), child: SafeArea(child: AppDrawer()),
title: Text('Home'), ),
backgroundColor: Colors.red, // ,
activeIcon: Icon(Icons.home)), bottomNavigationBar: (pageOnly == true || showBottomBar == false)
BottomNavigationBarItem( ? null
icon: new Icon(Icons.mail), : BottomNavigationBar(items: [
title: new Text('Messages'), BottomNavigationBarItem(
), icon: Icon(DoctorApp.home_icon),
BottomNavigationBarItem(icon: Icon(Icons.apps), title: Text('Menu')) title: Text('Home'),
]), backgroundColor: Colors.red,
body: body, activeIcon: Icon(Icons.home)),
); BottomNavigationBarItem(
icon: new Icon(Icons.mail),
title: new Text('Messages'),
),
BottomNavigationBarItem(
icon: Icon(Icons.apps), title: Text('Menu'))
]),
body: (pageOnly == true || showCurve == false)
? body
: Stack(
children: <Widget>[
ClipPath(
clipper: CustomShapeClipper(),
child: Container(
height: SizeConfig.realScreenHeight * 0.40,
decoration:
BoxDecoration(color: Hexcolor('#FFDDD9')))),
Positioned(
// key: ,
// top: SizeConfig.realScreenHeight * 0.10,
child: body)
],
));
} }
} }

@ -0,0 +1,26 @@
import 'package:flutter/material.dart';
class CustomShapeClipper extends CustomClipper<Path> {
@override
Path getClip(Size size) {
final Path path = Path();
path.lineTo(0.0, size.height);
var firstEndPoint = Offset(size.width * .5, size.height / 2);
var firstControlpoint = Offset(size.width * 0.25, size.height * 0.95 + 30);
path.quadraticBezierTo(firstControlpoint.dx, firstControlpoint.dy,
firstEndPoint.dx, firstEndPoint.dy);
var secondEndPoint = Offset(size.width, size.height * 0.10);
var secondControlPoint = Offset(size.width * .75, size.height * .10 - 20);
path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy,
secondEndPoint.dx, secondEndPoint.dy);
path.lineTo(size.width, 0.0);
path.close();
return path;
}
@override
bool shouldReclip(CustomClipper oldClipper) => true;
}
Loading…
Cancel
Save