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,21 +12,8 @@ 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: Stack( body: Container(
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: Container(
// decoration: BoxDecoration(color: Colors.red),
// margin: EdgeInsets.symmetric(vertical: 500),
child: Column( child: Column(
children: litems.map((item) { children: litems.map((item) {
return CardWithBgWidget( return CardWithBgWidget(
@ -41,9 +26,7 @@ class PatientsScreen extends StatelessWidget {
}).toList(), }).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,31 +7,39 @@ 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)
? null
: AppBar(
elevation: 0, elevation: 0,
backgroundColor: Hexcolor('#FFDDD9'), backgroundColor: Hexcolor('#FFDDD9'),
textTheme: TextTheme( textTheme: TextTheme(
title: TextStyle(color: Colors.black, fontWeight: FontWeight.bold)), title: TextStyle(
color: Colors.black, fontWeight: FontWeight.bold)),
title: Text(appBarTitle), title: Text(appBarTitle),
leading: Builder(builder: (BuildContext context) { leading: Builder(builder: (BuildContext context) {
return new GestureDetector( return new GestureDetector(
@ -48,14 +58,18 @@ class AppScaffold extends StatelessWidget {
IconButton(icon: Icon(Icons.person), onPressed: null) IconButton(icon: Icon(Icons.person), onPressed: null)
], ],
), ),
drawer: (pageOnly == true || showAppDrawer == false)?null:Theme( drawer: (pageOnly == true || showAppDrawer == false)
? null
: Theme(
data: Theme.of(context).copyWith( data: Theme.of(context).copyWith(
canvasColor: Colors.transparent, canvasColor: Colors.transparent,
), ),
child: SafeArea(child: AppDrawer()), child: SafeArea(child: AppDrawer()),
), ),
// , // ,
bottomNavigationBar: (pageOnly == true || showBottomBar == false)?null: BottomNavigationBar(items: [ bottomNavigationBar: (pageOnly == true || showBottomBar == false)
? null
: BottomNavigationBar(items: [
BottomNavigationBarItem( BottomNavigationBarItem(
icon: Icon(DoctorApp.home_icon), icon: Icon(DoctorApp.home_icon),
title: Text('Home'), title: Text('Home'),
@ -65,9 +79,26 @@ class AppScaffold extends StatelessWidget {
icon: new Icon(Icons.mail), icon: new Icon(Icons.mail),
title: new Text('Messages'), title: new Text('Messages'),
), ),
BottomNavigationBarItem(icon: Icon(Icons.apps), title: Text('Menu')) BottomNavigationBarItem(
icon: Icon(Icons.apps), title: Text('Menu'))
]), ]),
body: body, 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