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/settings/settings_screen.dart';
const String INIT_ROUTE = PATIENTS;
const String INIT_ROUTE = LOGIN;
const String HOME = '/';
const String LOGIN = 'login';
const String CHANGE_PASSWORD = 'change-password';

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

@ -16,13 +16,6 @@ class MyScheduleScreen extends StatelessWidget {
// pageOnly: false,
appBarTitle: 'My Schdule',
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),
child: ListView(children: <Widget>[
Column(

@ -1,7 +1,5 @@
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/card_with_bg_widget.dart';
@ -14,36 +12,21 @@ class PatientsScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return AppScaffold(
// pageOnly: false,
appBarTitle: 'Patients',
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: 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(),
),
),
)
],
));
appBarTitle: 'Patients',
body: Container(
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 '../../presentation/doctor_app_icons.dart';
@ -5,69 +7,98 @@ import '../../widgets/shared/app_drawer_widget.dart';
import 'package:flutter/material.dart';
class AppScaffold extends StatelessWidget {
AppScaffold(
{this.pageOnly,
this.appBarTitle,
this.showAppBar,
this.showBottomBar,
this.showAppDrawer,
this.body});
bool pageOnly = false;
// bool showAll =
bool showAppBar = true;
bool showAppDrawer = true;
bool showBottomBar = true;
String appBarTitle='';
bool showbg = true;
bool showCurve = true;
String appBarTitle = '';
Widget body;
AppScaffold(
{this.pageOnly,
this.appBarTitle,
this.showAppBar,
this.showBottomBar,
this.showAppDrawer,
this.body,
this.showbg,
this.showCurve});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Hexcolor('#FCF7F7'),
appBar: (pageOnly == true || showAppBar == false)?null:AppBar(
elevation: 0,
backgroundColor: Hexcolor('#FFDDD9'),
textTheme: TextTheme(
title: TextStyle(color: Colors.black, fontWeight: FontWeight.bold)),
title: Text(appBarTitle),
leading: Builder(builder: (BuildContext context) {
return new GestureDetector(
onTap: () {
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)
],
),
drawer: (pageOnly == true || showAppDrawer == false)?null:Theme(
data: Theme.of(context).copyWith(
canvasColor: Colors.transparent,
),
child: SafeArea(child: AppDrawer()),
),
// ,
bottomNavigationBar: (pageOnly == true || showBottomBar == false)?null: BottomNavigationBar(items: [
BottomNavigationBarItem(
icon: Icon(DoctorApp.home_icon),
title: Text('Home'),
backgroundColor: Colors.red,
activeIcon: Icon(Icons.home)),
BottomNavigationBarItem(
icon: new Icon(Icons.mail),
title: new Text('Messages'),
),
BottomNavigationBarItem(icon: Icon(Icons.apps), title: Text('Menu'))
]),
body: body,
);
backgroundColor:
(pageOnly == true || showbg == false) ? null : Hexcolor('#FCF7F7'),
appBar: (pageOnly == true || showAppBar == false)
? null
: AppBar(
elevation: 0,
backgroundColor: Hexcolor('#FFDDD9'),
textTheme: TextTheme(
title: TextStyle(
color: Colors.black, fontWeight: FontWeight.bold)),
title: Text(appBarTitle),
leading: Builder(builder: (BuildContext context) {
return new GestureDetector(
onTap: () {
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)
],
),
drawer: (pageOnly == true || showAppDrawer == false)
? null
: Theme(
data: Theme.of(context).copyWith(
canvasColor: Colors.transparent,
),
child: SafeArea(child: AppDrawer()),
),
// ,
bottomNavigationBar: (pageOnly == true || showBottomBar == false)
? null
: BottomNavigationBar(items: [
BottomNavigationBarItem(
icon: Icon(DoctorApp.home_icon),
title: Text('Home'),
backgroundColor: Colors.red,
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