Created
July 12, 2019 13:34
-
-
Save yousefmasry4/c28f2a04dfaee03505ab9aa21e98efd4 to your computer and use it in GitHub Desktop.
my
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter/painting.dart'; | |
import 'dart:async'; | |
import 'package:flutter/widgets.dart'; | |
class op extends StatefulWidget { | |
const op({Key key}) : super(key: key); | |
@override | |
page createState() => page(); | |
} | |
class page extends State<op> with SingleTickerProviderStateMixin { | |
AnimationController _controller; | |
Future sleep() { | |
return new Future.delayed(const Duration(seconds: 1), () => "1"); | |
} | |
@override | |
void initState() { | |
super.initState(); | |
_controller = AnimationController( | |
duration: const Duration(seconds: 10), | |
vsync: this, | |
)..repeat(); | |
} | |
Animatable<Color> background = TweenSequence<Color>([ | |
TweenSequenceItem( | |
weight: 1.0, | |
tween: ColorTween( | |
begin: Colors.blueAccent, | |
end: Colors.indigo, | |
), | |
), | |
TweenSequenceItem( | |
weight: 1, | |
tween: ColorTween( | |
begin: Colors.indigo, | |
end: Colors.purple, | |
), | |
), | |
TweenSequenceItem( | |
weight: 1.0, | |
tween: ColorTween( | |
begin: Colors.purple, | |
end: Colors.blueAccent, | |
), | |
), | |
]); | |
var _opacity = 1.0; | |
int a=0; | |
void one(){ | |
setState(() async { | |
if (a!=1) { | |
_opacity = _opacity == 0.0 ? 1.0 : 0.0; | |
await new Future.delayed(const Duration(seconds: 2)); | |
a++; | |
_opacity = _opacity == 0.0 ? 1.0 : 0.0; | |
} | |
}); | |
} | |
@override | |
Widget build(BuildContext context) { | |
var _width =MediaQuery.of(context).size.width; | |
return AnimatedBuilder( | |
animation: _controller, | |
builder: (context, child) { | |
return Scaffold( | |
body:InkWell( | |
onTap: () { | |
one(); | |
}, | |
child:Container( | |
color: background | |
.evaluate(AlwaysStoppedAnimation(_controller.value)), | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
data(a), | |
], | |
), | |
), | |
), | |
); | |
}); | |
} | |
Widget data(int a)=>GestureDetector( | |
child: Container( | |
alignment: Alignment.center, | |
child: AnimatedOpacity( | |
duration: Duration(seconds: 1), | |
opacity: _opacity, | |
child:new Column( | |
children: <Widget>[ | |
Center( | |
child: Text( | |
d(a), | |
style: TextStyle(color: Colors.white, fontSize: 65.0,fontWeight: FontWeight.bold), | |
), | |
), | |
a ==0? Text( | |
'click anywhere to Continue', | |
style: TextStyle(color: Colors.white, fontSize: 10.0,fontWeight: FontWeight.w600), | |
textAlign: TextAlign.right, | |
): | |
Row( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
a == 1?b(): | |
Container( | |
width: 15, | |
), | |
a == 1?b2():Container(), | |
], | |
), | |
], | |
), | |
), | |
), | |
); | |
void move(String newRouteName_,BuildContext context){ | |
Navigator.of(context).pushNamedAndRemoveUntil(newRouteName_, (Route<dynamic> route) => false); | |
} | |
Widget b()=>RaisedButton( | |
onPressed: (){ | |
setState(() async { | |
_opacity = _opacity == 0.0 ? 1.0 : 0.0; | |
await new Future.delayed(const Duration(seconds: 2)); | |
a=2; | |
_opacity = _opacity == 0.0 ? 1.0 : 0.0; | |
await new Future.delayed(const Duration(seconds: 2)); | |
_opacity = _opacity == 0.0 ? 1.0 : 0.0; | |
await new Future.delayed(const Duration(seconds: 1)); | |
move("/start", context); | |
}); | |
}, | |
color: Colors.indigoAccent, | |
textColor: Colors.white, | |
elevation: 15, | |
child:Text('Yes', | |
style: TextStyle(fontSize: 20)), | |
); | |
Widget b2()=>RaisedButton( | |
onPressed: () {}, | |
color: Colors.cyan, | |
textColor: Colors.white, | |
elevation: 15, | |
child:Text('No', | |
style: TextStyle(fontSize: 20)), | |
); | |
} | |
String d(int a){ | |
if ( a == 0){ | |
return "Let's Start"; | |
}else if(a==1){ | |
return "Do you have an account "; | |
}else if(a==2){ | |
return "glad to see you again"; | |
}else{ | |
return "let's make a new account "; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter/painting.dart'; | |
import 'dart:async'; | |
import 'dart:convert'; | |
import 'package:http/http.dart' as http; | |
class page1 extends StatefulWidget { | |
const page1({Key key}) : super(key: key); | |
@override | |
page createState() => page(); | |
} | |
String newRouteName; | |
int admin = 0; | |
int index = 0; | |
/****************************************************/ | |
/*************************************************/ | |
int i = 0; | |
double val; | |
class page extends State<page1> { | |
Map data; | |
List userData; | |
Future getdata() async { | |
http.Response response = | |
await http.get("https://reqres.in/api/users?page=2"); | |
data = json.decode(response.body); | |
print(data); | |
setState(() { | |
userData = data["data"]; | |
val = 0.04; | |
}); | |
} | |
final GlobalKey<RefreshIndicatorState> _refreshIndicatorKey = | |
new GlobalKey<RefreshIndicatorState>(); | |
int nodata() { | |
getdata(); | |
return 0; | |
} | |
@override | |
Widget build(BuildContext context) { | |
double c_width = MediaQuery.of(context).size.width * 0.8; | |
final _height = MediaQuery.of(context).size.height; | |
Future<void> note() async { | |
return showDialog<void>( | |
context: context, | |
barrierDismissible: false, // user must tap button! | |
builder: (BuildContext context) { | |
return AlertDialog( | |
backgroundColor: Colors.green, | |
title: Text( | |
'Notes:', | |
style: TextStyle(fontSize: 30.0), | |
), | |
content: SingleChildScrollView( | |
child: ListBody( | |
children: <Widget>[ | |
new Container( | |
padding: const EdgeInsets.all(16.0), | |
width: c_width, | |
child: Text( | |
"pla pla pla pla pla pla pla pla pla pla p laa la l la l la laladldalldsj njn nsdnj dbnfjsbgvbsn fndsjanf jnsjadg jsajfnjdbgjdasjvnjab", | |
textAlign: TextAlign.left, | |
style: new TextStyle( | |
fontWeight: FontWeight.bold, | |
fontStyle: FontStyle.italic), | |
), | |
), | |
new Divider( | |
height: _height / 30, | |
color: Colors.white, | |
), | |
], | |
), | |
), | |
actions: <Widget>[ | |
new Row( | |
children: <Widget>[ | |
FlatButton( | |
padding: EdgeInsets.all(20.0), | |
focusColor: Colors.green, | |
child: Text( | |
'close', | |
style: new TextStyle( | |
color: Colors.white, | |
), | |
), | |
color: Colors.red, | |
onPressed: () { | |
Navigator.of(context).pop(); | |
getdata(); | |
}, | |
), | |
], | |
), | |
], | |
); | |
}, | |
); | |
} | |
Future<void> _alert(int position) async { | |
return showDialog<void>( | |
context: context, | |
barrierDismissible: false, // user must tap button! | |
builder: (BuildContext context) { | |
return AlertDialog( | |
backgroundColor: Colors.green, | |
title: Text( | |
'data', | |
style: TextStyle(fontSize: 30.0), | |
), | |
content: SingleChildScrollView( | |
child: ListBody( | |
children: <Widget>[ | |
Column( | |
children: <Widget>[ | |
new Row( | |
children: <Widget>[ | |
Text( | |
"locaion:", | |
style: new TextStyle(fontWeight: FontWeight.bold), | |
), | |
Expanded( | |
child: Text('${userData[position]["email"]}'), | |
), | |
], | |
) | |
], | |
), | |
new Divider( | |
height: _height / 30, | |
color: Colors.white, | |
), | |
Column( | |
children: <Widget>[ | |
new Row( | |
children: <Widget>[ | |
Text( | |
"day:", | |
style: new TextStyle(fontWeight: FontWeight.bold), | |
), | |
Expanded( | |
child: Text('${userData[position]["email"]}'), | |
), | |
], | |
) | |
], | |
), | |
new Divider( | |
height: _height / 30, | |
color: Colors.white, | |
), | |
Column( | |
children: <Widget>[ | |
new Row( | |
children: <Widget>[ | |
Text( | |
"duration", | |
style: new TextStyle(fontWeight: FontWeight.bold), | |
), | |
Expanded( | |
child: Text('${userData[position]["email"]}'), | |
), | |
], | |
) | |
], | |
), | |
new Divider( | |
height: _height / 30, | |
color: Colors.white, | |
), | |
Column( | |
children: <Widget>[ | |
new Row( | |
children: <Widget>[ | |
Text( | |
"starting at", | |
style: new TextStyle(fontWeight: FontWeight.bold), | |
), | |
Expanded( | |
child: Text('date:${userData[position]["email"]}'), | |
), | |
], | |
) | |
], | |
), | |
new Divider( | |
height: _height / 30, | |
color: Colors.white, | |
), | |
Column( | |
children: <Widget>[ | |
new Row( | |
children: <Widget>[ | |
Text( | |
"posted by", | |
style: new TextStyle(fontWeight: FontWeight.bold), | |
), | |
Expanded( | |
child: Text('${userData[position]["email"]}'), | |
), | |
], | |
) | |
], | |
), | |
new Divider( | |
height: _height / 30, | |
color: Colors.white, | |
), | |
Column( | |
children: <Widget>[ | |
new Row( | |
children: <Widget>[ | |
Text( | |
"statues", | |
style: new TextStyle(fontWeight: FontWeight.bold), | |
), | |
Expanded( | |
child: Text('${userData[position]["email"]}'), | |
), | |
], | |
) | |
], | |
), | |
new Divider( | |
height: _height / 30, | |
color: Colors.white, | |
), | |
], | |
), | |
), | |
actions: <Widget>[ | |
new Row( | |
children: <Widget>[ | |
FlatButton( | |
padding: EdgeInsets.all(20.0), | |
focusColor: Colors.green, | |
child: Text( | |
'Next', | |
style: new TextStyle( | |
color: Colors.white, | |
), | |
), | |
color: Colors.blue, | |
onPressed: () { | |
Navigator.of(context).pop(); | |
getdata(); | |
note(); | |
}, | |
), | |
], | |
), | |
], | |
); | |
}, | |
); | |
} | |
return Scaffold( | |
appBar: AppBar( | |
backgroundColor: Colors.deepPurple, | |
), | |
bottomNavigationBar: new BottomNavigationBar( | |
backgroundColor: Colors.blueAccent, | |
type: BottomNavigationBarType.fixed, | |
fixedColor: Colors.yellowAccent, | |
currentIndex: index = 0, | |
onTap: (int ind) { | |
setState(() { | |
index = ind; | |
if(ind == 1 && admin==0) | |
newRouteName="/0"; | |
else if(ind==2 && admin ==0) | |
newRouteName="/2"; | |
else if(ind==3 && admin ==0) | |
newRouteName="/3"; | |
else if(ind==0 && admin ==0) | |
newRouteName=null; | |
}); | |
Navigator.of(context).pushNamedAndRemoveUntil(newRouteName, (Route<dynamic> route)=>false); | |
}, | |
items: [ | |
new BottomNavigationBarItem( | |
icon: new Icon(Icons.add_alert), | |
title: new Text("notifications"), | |
), | |
new BottomNavigationBarItem( | |
icon: new Icon(Icons.home), | |
title: new Text("Home"), | |
), | |
new BottomNavigationBarItem( | |
icon: new Icon(Icons.add_circle), | |
title: new Text("add new"), | |
), | |
new BottomNavigationBarItem( | |
icon: new Icon(Icons.settings), | |
title: new Text("settings"), | |
), | |
], | |
), | |
body: new RefreshIndicator( | |
color: Colors.blue, | |
key: _refreshIndicatorKey, | |
onRefresh: getdata, | |
child: new Container( | |
color: Colors.white70, | |
child: new ListView.builder( | |
padding: EdgeInsets.all(12.0), | |
itemCount: userData == null ? nodata() : userData.length, | |
itemBuilder: (BuildContext context, int position) { | |
return Card( | |
child: new Column(children: <Widget>[ | |
new ListTile( | |
title: new Text( | |
'You are accepted by}', | |
style: TextStyle(fontSize: 20.0, color: Colors.black), | |
), | |
subtitle: new Text( | |
'click me', | |
style: TextStyle( | |
fontSize: 10.0, | |
color: Colors.blueAccent, | |
fontStyle: FontStyle.normal), | |
), | |
leading: new CircleAvatar( | |
foregroundColor: Colors.green, | |
backgroundImage: new NetworkImage( | |
'https://s3.amazonaws.com/uifaces/faces/twitter/marcoramires/128.jpg'), | |
), | |
onTap: () { | |
_alert(position); | |
}, | |
), | |
]), | |
); | |
}, | |
), | |
), | |
), | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter/painting.dart'; | |
import 'dart:async'; | |
import 'dart:convert'; | |
import 'package:http/http.dart' as http; | |
import 'initial_list.dart'; | |
import 'list_model.dart'; | |
import 'task_row.dart'; | |
import 'package:flutter_circular_chart/flutter_circular_chart.dart'; | |
class page2 extends StatefulWidget { | |
const page2({Key key}) : super(key: key); | |
@override | |
page createState() => page(); | |
} | |
String newRouteName; | |
int admin = 0; | |
int index = 1; | |
/****************************************************/ | |
/*************************************************/ | |
int i = 0; | |
double val; | |
class Iqtem { | |
String d; | |
String m; | |
double act; | |
MaterialColor color; | |
Iqtem(this.d,this.m,this.act, this.color ); | |
} | |
List<Iqtem> qtems = [ | |
Iqtem('12','2',0, Colors.amber), | |
Iqtem('15','2',0, Colors.cyan), | |
Iqtem('16','2',0, Colors.indigo), | |
Iqtem('18','2', 0, Colors.green), | |
Iqtem('19','2',0, Colors.pink), | |
Iqtem('20','2', 0, Colors.blue) | |
]; | |
int prev_item=0; | |
class page extends State<page2> { | |
Map data; | |
List userData; | |
Future getdata() async { | |
http.Response response = | |
await http.get("https://reqres.in/api/users?page=2"); | |
data = json.decode(response.body); | |
print(data); | |
setState(() { | |
userData = data["data"]; | |
val = 0.04; | |
}); | |
} | |
final GlobalKey<RefreshIndicatorState> _refreshIndicatorKey = | |
new GlobalKey<RefreshIndicatorState>(); | |
int nodata() { | |
getdata(); | |
return 0; | |
} | |
int green = 0; | |
int red = 0; | |
int blue = 0; | |
double cb() { | |
red = (val * 255).toInt(); | |
print(val); | |
print(red); | |
green = (255 - red).toInt(); | |
blue = (red - green); | |
if (blue < 0) blue *= -1; | |
print(green); | |
return val; | |
} | |
final GlobalKey<AnimatedListState> _listKey = | |
new GlobalKey<AnimatedListState>(); | |
final double _imageHeight = 256.0; | |
ListModel listModel; | |
bool showOnlyCompleted = false; | |
@override | |
void initState() { | |
super.initState(); | |
listModel = new ListModel(_listKey, tasks); | |
} | |
@override | |
Widget build(BuildContext context) { | |
final double dotSize = 12.0; | |
final _height = MediaQuery.of(context).size.height; | |
Future<void> _alert3() async { | |
return showDialog<void>( | |
context: context, | |
barrierDismissible: false, // user must tap button! | |
builder: (BuildContext context) { | |
return AlertDialog( | |
backgroundColor: Colors.amberAccent, | |
title: Text( | |
'you have been enrolled successful', | |
style: TextStyle(fontSize: 30.0), | |
), | |
content: SingleChildScrollView( | |
child: ListBody( | |
children: <Widget>[ | |
Text( | |
'your request will send to ${userData[0]["email"]} , when he accepted you we will add it into notifications'), | |
new Divider( | |
height: _height / 30, | |
color: Colors.white, | |
), | |
], | |
), | |
), | |
actions: <Widget>[ | |
FlatButton( | |
child: Text( | |
'close', | |
style: new TextStyle( | |
color: Colors.white, | |
), | |
), | |
color: Colors.red, | |
onPressed: () { | |
getdata(); | |
Navigator.of(context).pop(); | |
}, | |
), | |
], | |
); | |
}, | |
); | |
} | |
Future<void> _alert2() async { | |
return showDialog<void>( | |
context: context, | |
barrierDismissible: false, // user must tap button! | |
builder: (BuildContext context) { | |
return AlertDialog( | |
backgroundColor: Colors.amberAccent, | |
title: Text( | |
'note:', | |
style: TextStyle(fontSize: 30.0), | |
), | |
content: SingleChildScrollView( | |
child: ListBody( | |
children: <Widget>[ | |
Text( | |
'are you sure from that you wanna enrolling in ${userData[0]["email"]} at ${userData[0]["email"]}'), | |
new Divider( | |
height: _height / 30, | |
color: Colors.white, | |
), | |
], | |
), | |
), | |
actions: <Widget>[ | |
new Row( | |
children: <Widget>[ | |
FlatButton( | |
padding: EdgeInsets.all(20.0), | |
focusColor: Colors.green, | |
child: Text( | |
'close', | |
style: new TextStyle( | |
color: Colors.white, | |
), | |
), | |
color: Colors.red, | |
onPressed: () { | |
Navigator.of(context).pop(); | |
getdata(); | |
}, | |
), | |
FlatButton( | |
color: Colors.blue, | |
textColor: Colors.white, | |
disabledColor: Colors.grey, | |
disabledTextColor: Colors.black, | |
padding: EdgeInsets.all(20.0), | |
splashColor: Colors.blueAccent, | |
child: Text( | |
'enrolling', | |
style: new TextStyle( | |
color: Colors.white, | |
), | |
), | |
onPressed: () { | |
/************************************************************************** | |
add data to cloud | |
*********************************************************************************/ | |
Navigator.of(context).pop(); | |
_alert3(); | |
getdata(); | |
}, | |
), | |
], | |
), | |
], | |
); | |
}, | |
); | |
} | |
Future<void> _alert(int position) async { | |
return showDialog<void>( | |
context: context, | |
barrierDismissible: false, // user must tap button! | |
builder: (BuildContext context) { | |
return AlertDialog( | |
backgroundColor: Colors.green, | |
title: Text( | |
'data', | |
style: TextStyle(fontSize: 30.0), | |
), | |
content: SingleChildScrollView( | |
child: ListBody( | |
children: <Widget>[ | |
Column( | |
children: <Widget>[ | |
new Row( | |
children: <Widget>[ | |
Text( | |
"locaion:", | |
style: new TextStyle(fontWeight: FontWeight.bold), | |
), | |
Expanded( | |
child: Text('${userData[position]["email"]}'), | |
), | |
], | |
) | |
], | |
), | |
new Divider( | |
height: _height / 30, | |
color: Colors.white, | |
), | |
Column( | |
children: <Widget>[ | |
new Row( | |
children: <Widget>[ | |
Text( | |
"day:", | |
style: new TextStyle(fontWeight: FontWeight.bold), | |
), | |
Expanded( | |
child: Text('${userData[position]["email"]}'), | |
), | |
], | |
) | |
], | |
), | |
new Divider( | |
height: _height / 30, | |
color: Colors.white, | |
), | |
Column( | |
children: <Widget>[ | |
new Row( | |
children: <Widget>[ | |
Text( | |
"duration", | |
style: new TextStyle(fontWeight: FontWeight.bold), | |
), | |
Expanded( | |
child: Text('${userData[position]["email"]}'), | |
), | |
], | |
) | |
], | |
), | |
new Divider( | |
height: _height / 30, | |
color: Colors.white, | |
), | |
Column( | |
children: <Widget>[ | |
new Row( | |
children: <Widget>[ | |
Text( | |
"starting at", | |
style: new TextStyle(fontWeight: FontWeight.bold), | |
), | |
Expanded( | |
child: Text('date:${userData[position]["email"]}'), | |
), | |
], | |
) | |
], | |
), | |
new Divider( | |
height: _height / 30, | |
color: Colors.white, | |
), | |
Column( | |
children: <Widget>[ | |
new Row( | |
children: <Widget>[ | |
Text( | |
"posted by", | |
style: new TextStyle(fontWeight: FontWeight.bold), | |
), | |
Expanded( | |
child: Text('${userData[position]["email"]}'), | |
), | |
], | |
) | |
], | |
), | |
new Divider( | |
height: _height / 30, | |
color: Colors.white, | |
), | |
Column( | |
children: <Widget>[ | |
new Row( | |
children: <Widget>[ | |
Text( | |
"statues", | |
style: new TextStyle(fontWeight: FontWeight.bold), | |
), | |
Expanded( | |
child: Text('${userData[position]["email"]}'), | |
), | |
], | |
) | |
], | |
), | |
new Divider( | |
height: _height / 30, | |
color: Colors.white, | |
), | |
], | |
), | |
), | |
actions: <Widget>[ | |
new Row( | |
children: <Widget>[ | |
FlatButton( | |
padding: EdgeInsets.all(20.0), | |
focusColor: Colors.green, | |
child: Text( | |
'close', | |
style: new TextStyle( | |
color: Colors.white, | |
), | |
), | |
color: Colors.red, | |
onPressed: () { | |
Navigator.of(context).pop(); | |
getdata(); | |
}, | |
), | |
FlatButton( | |
color: Colors.blue, | |
textColor: Colors.white, | |
disabledColor: Colors.grey, | |
disabledTextColor: Colors.black, | |
padding: EdgeInsets.all(20.0), | |
splashColor: Colors.blueAccent, | |
child: Text( | |
'Next', | |
style: new TextStyle( | |
color: Colors.white, | |
), | |
), | |
onPressed: () { | |
/************************************************************************** | |
add data to cloud | |
*********************************************************************************/ | |
Navigator.of(context).pop(); | |
_alert2(); | |
getdata(); | |
}, | |
), | |
], | |
), | |
], | |
); | |
}, | |
); | |
} | |
return Scaffold( | |
appBar: AppBar( | |
backgroundColor: Colors.deepPurple, | |
), | |
bottomNavigationBar: new BottomNavigationBar( | |
backgroundColor: Colors.blueAccent, | |
type: BottomNavigationBarType.fixed, | |
fixedColor: Colors.yellowAccent, | |
currentIndex: index = 1, | |
onTap: (int ind) { | |
setState(() { | |
if (ind == 0 && admin == 0) | |
newRouteName = "/0"; | |
else if (ind == 2 && admin == 0) | |
newRouteName = "/3"; | |
else if (ind == 1) { | |
newRouteName = null; | |
} | |
}); | |
Navigator.of(context).pushNamedAndRemoveUntil( | |
newRouteName, (Route<dynamic> route) => false); | |
/*_navigateToScreens(index);*/ | |
print(newRouteName); | |
}, | |
items: [ | |
new BottomNavigationBarItem( | |
icon: new Icon(Icons.home), | |
title: new Text("Home"), | |
), | |
new BottomNavigationBarItem( | |
icon: new Icon(Icons.add_circle), | |
title: new Text("add new"), | |
), | |
new BottomNavigationBarItem( | |
icon: new Icon(Icons.settings), | |
title: new Text("settings"), | |
), | |
], | |
), | |
body: new Stack( | |
children: <Widget>[ | |
_buildTimeline(), | |
horizontalList1(), | |
_buildBottomPart(), | |
], | |
), | |
); | |
} | |
Widget _buildBottomPart() { | |
return new Padding( | |
padding: new EdgeInsets.only(top: _imageHeight-50), | |
child: new Column( | |
crossAxisAlignment: CrossAxisAlignment.stretch, | |
children: <Widget>[ | |
_buildMyTasksHeader(), | |
_buildTasksList(), | |
], | |
), | |
); | |
} | |
Widget _buildTasksList() { | |
return new Expanded( | |
child: new AnimatedList( | |
initialItemCount: tasks.length, | |
key: _listKey, | |
itemBuilder: (context, index, animation) { | |
return new TaskRow( | |
task: listModel[index], | |
animation: animation, | |
); | |
}, | |
), | |
); | |
} | |
Widget _buildMyTasksHeader() { | |
return new Container( | |
padding: new EdgeInsets.only(left: 44.0), | |
child: new Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: <Widget>[ | |
new Text( | |
'Active Events For This Day', | |
style: new TextStyle(fontSize: 24.0), | |
), | |
new Text( | |
qtems[prev_item].d+"/"+qtems[prev_item].m, | |
style: new TextStyle(color: Colors.grey, fontSize: 12.0), | |
), | |
], | |
), | |
); | |
} | |
Widget _buildTimeline() { | |
return new Positioned( | |
top: 0.0, | |
bottom: 0.0, | |
left: 32.0, | |
child: new Container( | |
width: 1.0, | |
color: Colors.grey[300], | |
), | |
); | |
} | |
Widget horizontalList1() => new Container( | |
margin: EdgeInsets.symmetric(vertical: 00.0), | |
height: 200.0, | |
child: new ListView( | |
scrollDirection: Axis.horizontal, | |
children: <Widget>[ | |
InkWell( | |
onTap: (){ | |
setState(() { | |
if(prev_item != -1) | |
qtems[prev_item].act=0; | |
prev_item=0; | |
qtems[prev_item].act=50; | |
print("hi........fdsfsafds"); | |
print("hidsfafdsasdf"); | |
}); | |
}, | |
child: Container( | |
width: 160.0, | |
height: 20.0, | |
color: qtems[0].color, | |
child: new Center( | |
child: Text( | |
"${qtems[0].d}\n ${qtems[0].m}", | |
style: TextStyle( | |
fontWeight: FontWeight.bold, | |
fontSize: 40+qtems[0].act, | |
color: Colors.white, | |
), | |
), | |
), | |
), | |
), | |
InkWell( | |
onTap: (){ | |
setState(() { | |
if(prev_item != -1) | |
qtems[prev_item].act=0; | |
prev_item=1; | |
qtems[prev_item].act=50; | |
print("hi............"); | |
print("hi"); | |
}); | |
}, | |
child: Container( | |
width: 160.0, | |
height: 20.0, | |
color: qtems[1].color, | |
child: new Center( | |
child: Text( | |
"${qtems[1].d}\n ${qtems[1].m}", | |
style: TextStyle( | |
fontWeight: FontWeight.bold, | |
fontSize: 40+qtems[1].act, | |
color: Colors.white, | |
), | |
), | |
), | |
), | |
), | |
InkWell( | |
onTap: (){ | |
setState(() { | |
if(prev_item != -1) | |
qtems[prev_item].act=0; | |
prev_item=2; | |
qtems[prev_item].act=50; | |
print("hi............"); | |
print("hi"); | |
}); | |
}, | |
child: Container( | |
width: 160.0, | |
height: 20.0, | |
color: qtems[2].color, | |
child: new Center( | |
child: Text( | |
"${qtems[2].d}\n ${qtems[2].m}", | |
style: TextStyle( | |
fontWeight: FontWeight.bold, | |
fontSize: 40+qtems[2].act, | |
color: Colors.white, | |
), | |
), | |
), | |
), | |
), | |
InkWell( | |
onTap: (){ | |
setState(() { | |
if(prev_item != -1) | |
qtems[prev_item].act=0; | |
prev_item=3; | |
qtems[prev_item].act=50; | |
print("hi............"); | |
print("hi"); | |
}); | |
}, | |
child: Container( | |
width: 160.0, | |
height: 20.0, | |
color: qtems[3].color, | |
child: new Center( | |
child: Text( | |
"${qtems[3].d}\n ${qtems[3].m}", | |
style: TextStyle( | |
fontWeight: FontWeight.bold, | |
fontSize: 40+qtems[3].act, | |
color: Colors.white, | |
), | |
), | |
), | |
), | |
), | |
InkWell( | |
onTap: (){ | |
setState(() { | |
if(prev_item != -1) | |
qtems[prev_item].act=0; | |
prev_item=4; | |
qtems[prev_item].act=50; | |
print("hi............"); | |
print("hi"); | |
}); | |
}, | |
child: Container( | |
width: 160.0, | |
height: 20.0, | |
color: qtems[4].color, | |
child: new Center( | |
child: Text( | |
"${qtems[4].d}\n ${qtems[4].m}", | |
style: TextStyle( | |
fontWeight: FontWeight.bold, | |
fontSize: 40+qtems[4].act, | |
color: Colors.white, | |
), | |
), | |
), | |
), | |
), | |
], | |
)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter/painting.dart'; | |
import 'dart:async'; | |
import 'dart:convert'; | |
import 'package:http/http.dart' as http; | |
import 'dart:ui' as ui; | |
String name; | |
String newRouteName; | |
int admin = 0; | |
int indexfunc() { | |
if (admin == 0) { | |
return 2; | |
} else { | |
return 1; | |
} | |
} | |
int index = indexfunc(); | |
String move_nav(String newRouteName, int admin, int ind) { | |
if (ind == 1 && admin == 0) | |
newRouteName = "/2"; | |
else if (ind == 0 ) | |
newRouteName = "/0"; | |
else if (ind == 1 && admin == 1 || ind == 2 && admin == 0) { | |
newRouteName = null; | |
} | |
return newRouteName; | |
} | |
void move(String newRouteName_, BuildContext context) { | |
Navigator.of(context) | |
.pushNamedAndRemoveUntil(newRouteName_, (Route<dynamic> route) => false); | |
} | |
void move_arrow(String route,BuildContext context){ | |
Navigator.pushNamed(context, route); | |
} | |
class page3 extends StatefulWidget { | |
page3({Key key, this.title}) : super(key: key); | |
final String title; | |
@override | |
_MyHomePageState createState() => new _MyHomePageState(); | |
} | |
class _MyHomePageState extends State<page3> { | |
@override | |
Widget build(BuildContext context) { | |
Widget native(BuildContext context) { | |
if (admin == 0) { | |
return new BottomNavigationBar( | |
backgroundColor: Colors.blueAccent, | |
type: BottomNavigationBarType.fixed, | |
fixedColor: Colors.yellowAccent, | |
currentIndex: index, | |
onTap: (int ind) { | |
setState(() { | |
newRouteName = move_nav(newRouteName, admin, ind); | |
}); | |
move(newRouteName, context); | |
/*_navigateToScreens(index);*/ | |
print(newRouteName); | |
}, | |
items: [ | |
new BottomNavigationBarItem( | |
icon: new Icon(Icons.home), | |
title: new Text("Home"), | |
), | |
new BottomNavigationBarItem( | |
icon: new Icon(Icons.add_circle), | |
title: new Text("add new"), | |
), | |
new BottomNavigationBarItem( | |
icon: new Icon(Icons.settings), | |
title: new Text("settings"), | |
), | |
], | |
); | |
} else { | |
return new BottomNavigationBar( | |
backgroundColor: Colors.blueAccent, | |
type: BottomNavigationBarType.fixed, | |
fixedColor: Colors.yellowAccent, | |
currentIndex: index, | |
onTap: (int ind) { | |
setState(() { | |
newRouteName = move_nav(newRouteName, admin, ind); | |
}); | |
/*_navigateToScreens(index);*/ | |
move(newRouteName, context); | |
/*_navigateToScreens(index);*/ | |
print(newRouteName); | |
}, | |
items: [ | |
new BottomNavigationBarItem( | |
icon: new Icon(Icons.home), | |
title: new Text("Home"), | |
), | |
new BottomNavigationBarItem( | |
icon: new Icon(Icons.settings), | |
title: new Text("settings"), | |
), | |
], | |
); | |
} | |
} | |
final _width = MediaQuery | |
.of(context) | |
.size | |
.width; | |
final _height = MediaQuery | |
.of(context) | |
.size | |
.height; | |
print(_width); | |
Future<void> server() async { | |
return showDialog<void>( | |
context: context, | |
barrierDismissible: false, // user must tap button! | |
builder: (BuildContext context) { | |
return AlertDialog( | |
backgroundColor: Colors.amberAccent, | |
title: Text( | |
'you are been enrolled successful', | |
style: TextStyle(fontSize: 30.0), | |
), | |
content: SingleChildScrollView( | |
child: ListBody( | |
children: <Widget>[ | |
Text('SERVER REPLAY'), | |
new Divider( | |
height: _height / 30, | |
color: Colors.white, | |
), | |
], | |
), | |
), | |
actions: <Widget>[ | |
FlatButton( | |
child: Text( | |
'close', | |
style: new TextStyle( | |
color: Colors.white, | |
), | |
), | |
color: Colors.red, | |
onPressed: () { | |
/* | |
SERVER | |
*/ | |
Navigator.of(context).pop(); | |
}, | |
), | |
], | |
); | |
}, | |
); | |
} | |
return new Stack( | |
children: <Widget>[ | |
new Image.network( | |
"https://upload.wikimedia.org/wikipedia/commons/d/da/AASTMT_Logo.png", | |
fit: BoxFit.cover, | |
height: 500, | |
), | |
new BackdropFilter( | |
filter: new ui.ImageFilter.blur( | |
sigmaX: 60.0, | |
sigmaY: 4.0, | |
), | |
child: new Container( | |
decoration: BoxDecoration( | |
color: Colors.white.withOpacity(0.9), | |
borderRadius: BorderRadius.all(Radius.circular(20.0)), | |
), | |
)), | |
new Scaffold( | |
appBar: AppBar( | |
backgroundColor: Colors.deepPurple, | |
), | |
bottomNavigationBar: native(context), | |
drawer: admin_button(), | |
backgroundColor: Colors.transparent, | |
body: new Center( | |
child: new ListView( | |
children: <Widget>[ | |
Column( | |
children: <Widget>[ | |
Row( | |
children: <Widget>[ | |
new Container( | |
margin: EdgeInsets.only( | |
left: 8.0, right: 8.0, top: 0.5), | |
child: Text( | |
"Account Settings", | |
textAlign: TextAlign.left, | |
style: new TextStyle( | |
fontWeight: FontWeight.w500, | |
fontSize: 030), | |
), | |
), | |
], | |
), | |
Row( | |
children: <Widget>[ | |
new Container( | |
child: SizedBox( | |
width: _width, | |
child: Text( | |
"Manage information about you,your personal informations , your password and your account in general", | |
textAlign: TextAlign.left, | |
style: new TextStyle( | |
fontWeight: FontWeight.w400), | |
), | |
), | |
), | |
], | |
), | |
], | |
), | |
Container(child: setingBox("Select Profile Picture", | |
"select a new beautiful photo of you", "/photo", context)), | |
setingBox( | |
"Email Address", "youssefmasry04@gmail.com", "/email", | |
context), | |
setingBox("Phone Number", "015 503 212 53", "/phone", context), | |
setingBox( | |
"password", | |
"it is a good idea to use a strong password\nthat you're not using elsewhere", | |
"/password", | |
context), | |
setingBox("Report a Problem", | |
"Your feedback help us to improve AAST Exam Committees", | |
"/report", context), | |
/* | |
FlatButton( | |
padding: EdgeInsets.all(20.0), | |
focusColor: Colors.green, | |
child: Text( | |
'Save Changes', | |
style: new TextStyle( | |
color: Colors.white, | |
), | |
), | |
color: Colors.red, | |
onPressed: () { | |
server(); | |
}, | |
), | |
FlatButton( | |
padding: EdgeInsets.all(20.0), | |
focusColor: Colors.green, | |
child: Text( | |
'Cansel', | |
style: new TextStyle( | |
color: Colors.white, | |
), | |
), | |
color: Colors.lightBlueAccent, | |
onPressed: () { | |
move("/3", context); | |
}, | |
), | |
*/ | |
], | |
), | |
), | |
), | |
], | |
); | |
} | |
Widget rowCell(int count, String type) => | |
new Expanded( | |
child: new Column( | |
children: <Widget>[ | |
new Text( | |
'$count', | |
style: new TextStyle(color: Colors.white), | |
), | |
new Text(type, | |
style: new TextStyle( | |
color: Colors.white, fontWeight: FontWeight.normal)) | |
], | |
)); | |
Widget admin_button() { | |
final MediaQueryData mediaQuery = MediaQuery.of(context); | |
final ThemeData themeData = Theme.of(context); | |
if (admin == 1) { | |
return new Drawer( | |
child: new Drawer( | |
child: new ListView( | |
primary: false, | |
children: <Widget>[ | |
new Container( | |
// Fake a drawer header | |
color: Colors.deepPurpleAccent, | |
padding: new EdgeInsets.only( | |
top: mediaQuery.padding.top + 0.0, bottom: 0.0), | |
child: new ListTile( | |
leading: new Icon(Icons.android, | |
color: themeData.primaryTextTheme.title.color), | |
title: new Text('admin', | |
style: themeData.primaryTextTheme.title), | |
), | |
), | |
new Divider(color: Colors.deepPurple), | |
ListTile( | |
leading: Icon(Icons.code), | |
title: Text('invitation code generation'), | |
onTap: () { | |
Navigator.pop(context); | |
}, | |
), | |
new Divider(color: Colors.deepPurple), | |
ListTile( | |
leading: Icon(Icons.add_circle_outline), | |
title: Text('New admin request'), | |
onTap: () { | |
Navigator.pop(context); | |
}, | |
), | |
new Divider(color: Colors.deepPurple), | |
Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: ListTile( | |
leading: Icon(Icons.accessibility), | |
title: Text('new member requests'), | |
onTap: () { | |
Navigator.pop(context); | |
}, | |
), | |
), | |
new Divider(color: Colors.deepPurple), | |
ListTile( | |
leading: Icon(Icons.add_alert), | |
title: Text('adding a new event'), | |
onTap: () { | |
Navigator.pop(context); | |
}, | |
), | |
new Divider(color: Colors.deepPurple), | |
ListTile( | |
leading: Icon(Icons.announcement), | |
title: Text('my active events'), | |
onTap: () { | |
Navigator.pop(context); | |
}, | |
), | |
new Divider(color: Colors.deepPurple), | |
], | |
), | |
), | |
); | |
} | |
} | |
Widget setingBox(String name, String data, String r, BuildContext context) { | |
return Card( | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.all(Radius.circular(0.0)), | |
), | |
margin: EdgeInsets.only(left: 8.0, right: 8.0, top: 0.5), | |
child: Container( | |
height: 80.0, | |
padding: EdgeInsets.only(left: 16.0, top: 16.0, bottom: 0.0), | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: <Widget>[ | |
Flexible( | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
mainAxisAlignment: MainAxisAlignment.spaceAround, | |
children: <Widget>[ | |
Text( | |
name, | |
style: TextStyle( | |
fontWeight: FontWeight.w900, | |
fontSize: 25, | |
), | |
maxLines: 1, | |
overflow: TextOverflow.ellipsis, | |
), | |
Text( | |
data, | |
style: TextStyle( | |
fontWeight: FontWeight.w400, | |
), | |
maxLines: 1, | |
overflow: TextOverflow.ellipsis, | |
), | |
], | |
), | |
), | |
IconButton( | |
onPressed: () => move_arrow(r, context), | |
icon: Icon( | |
Icons.arrow_forward_ios, | |
size: 23.0, | |
color: Colors.blue[600], | |
), | |
), | |
], | |
), | |
), | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:math' as math; | |
import 'package:flutter/material.dart'; | |
class AnimatedFab extends StatefulWidget { | |
final VoidCallback onClick; | |
const AnimatedFab({Key key, this.onClick}) : super(key: key); | |
@override | |
_AnimatedFabState createState() => new _AnimatedFabState(); | |
} | |
class _AnimatedFabState extends State<AnimatedFab> | |
with SingleTickerProviderStateMixin { | |
AnimationController _animationController; | |
Animation<Color> _colorAnimation; | |
final double expandedSize = 180.0; | |
final double hiddenSize = 20.0; | |
@override | |
void initState() { | |
super.initState(); | |
_animationController = new AnimationController( | |
vsync: this, duration: Duration(milliseconds: 200)); | |
_colorAnimation = new ColorTween(begin: Colors.pink, end: Colors.pink[800]) | |
.animate(_animationController); | |
} | |
@override | |
void dispose() { | |
_animationController.dispose(); | |
super.dispose(); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return new SizedBox( | |
width: expandedSize, | |
height: expandedSize, | |
child: new AnimatedBuilder( | |
animation: _animationController, | |
builder: (BuildContext context, Widget child) { | |
return new Stack( | |
alignment: Alignment.center, | |
children: <Widget>[ | |
_buildExpandedBackground(), | |
_buildOption(Icons.check_circle, 0.0), | |
_buildOption(Icons.flash_on, -math.pi / 3), | |
_buildOption(Icons.access_time, -2 * math.pi / 3), | |
_buildOption(Icons.error_outline, math.pi), | |
_buildFabCore(), | |
], | |
); | |
}, | |
), | |
); | |
} | |
Widget _buildOption(IconData icon, double angle) { | |
if (_animationController.isDismissed) { | |
return Container(); | |
} | |
double iconSize = 0.0; | |
if (_animationController.value > 0.8) { | |
iconSize = 26.0 * (_animationController.value - 0.8) * 5; | |
} | |
return new Transform.rotate( | |
angle: angle, | |
child: new Align( | |
alignment: Alignment.topCenter, | |
child: new Padding( | |
padding: new EdgeInsets.only(top: 8.0), | |
child: new IconButton( | |
onPressed: _onIconClick, | |
icon: new Transform.rotate( | |
angle: -angle, | |
child: new Icon( | |
icon, | |
color: Colors.white, | |
), | |
), | |
iconSize: iconSize, | |
alignment: Alignment.center, | |
padding: new EdgeInsets.all(0.0), | |
), | |
), | |
), | |
); | |
} | |
Widget _buildExpandedBackground() { | |
double size = | |
hiddenSize + (expandedSize - hiddenSize) * _animationController.value; | |
return new Container( | |
height: size, | |
width: size, | |
decoration: new BoxDecoration(shape: BoxShape.circle, color: Colors.pink), | |
); | |
} | |
Widget _buildFabCore() { | |
double scaleFactor = 2 * (_animationController.value - 0.5).abs(); | |
return new FloatingActionButton( | |
onPressed: _onFabTap, | |
child: new Transform( | |
alignment: Alignment.center, | |
transform: new Matrix4.identity()..scale(1.0, scaleFactor), | |
child: new Icon( | |
_animationController.value > 0.5 ? Icons.close : Icons.filter_list, | |
color: Colors.white, | |
size: 26.0, | |
), | |
), | |
backgroundColor: _colorAnimation.value, | |
); | |
} | |
open() { | |
if (_animationController.isDismissed) { | |
_animationController.forward(); | |
} | |
} | |
close() { | |
if (_animationController.isCompleted) { | |
_animationController.reverse(); | |
} | |
} | |
_onFabTap() { | |
if (_animationController.isDismissed) { | |
open(); | |
} else { | |
close(); | |
} | |
} | |
_onIconClick() { | |
widget.onClick(); | |
close(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class Background extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
resizeToAvoidBottomPadding: false, | |
backgroundColor: Colors.white, | |
body: Column( | |
children: <Widget>[ | |
new Stack( | |
alignment: Alignment.bottomCenter, | |
children: <Widget>[ | |
WavyHeader(), | |
], | |
), | |
Expanded( | |
child: Container( | |
), | |
), | |
Stack( | |
alignment: Alignment.bottomLeft, | |
children: <Widget>[ | |
WavyFooter(), | |
CirclePink(), | |
CircleYellow(), | |
], | |
) | |
], | |
), | |
); | |
} | |
} | |
const List<Color> orangeGradients = [ | |
Colors.blue, | |
Color(0xFF5AEAF1), | |
Color(0xFF8EF7DA), | |
Colors.cyan, | |
]; | |
const List<Color> aquaGradients = [ | |
Color(0xFF5AEAF1), | |
Color(0xFF8EF7DA), | |
]; | |
class WavyHeader extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return ClipPath( | |
clipper: TopWaveClipper(), | |
child: Container( | |
decoration: BoxDecoration( | |
gradient: LinearGradient( | |
colors: orangeGradients, | |
begin: Alignment.topLeft, | |
end: Alignment.topRight), | |
), | |
height: MediaQuery.of(context).size.height / 2, | |
), | |
); | |
} | |
} | |
class WavyFooter extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return ClipPath( | |
clipper: FooterWaveClipper(), | |
child: Container( | |
decoration: BoxDecoration( | |
gradient: LinearGradient( | |
colors: aquaGradients, | |
begin: Alignment.bottomRight, | |
end: Alignment.topCenter), | |
), | |
height: MediaQuery.of(context).size.height / 2.5, | |
), | |
); | |
} | |
} | |
class CirclePink extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Transform.translate( | |
offset: Offset(-70.0, 90.0), | |
child: Material( | |
color: Colors.pink, | |
child: Padding(padding: EdgeInsets.all(120)), | |
shape: CircleBorder(side: BorderSide(color: Colors.white, width: 15.0)), | |
), | |
); | |
} | |
} | |
class CircleYellow extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Transform.translate( | |
offset: Offset(0.0, 210.0), | |
child: Material( | |
color: Colors.yellow, | |
child: Padding(padding: EdgeInsets.all(140)), | |
shape: CircleBorder(side: BorderSide(color: Colors.white, width: 15.0)), | |
), | |
); | |
} | |
} | |
class TopWaveClipper extends CustomClipper<Path> { | |
@override | |
Path getClip(Size size) { | |
// This is where we decide what part of our image is going to be visible. | |
var path = Path(); | |
path.lineTo(0.0, size.height); | |
var firstControlPoint = new Offset(size.width / 7, size.height - 20); | |
var firstEndPoint = new Offset(size.width / 6, size.height / 1.5); | |
path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy, | |
firstEndPoint.dx, firstEndPoint.dy); | |
var secondControlPoint = Offset(size.width / 5, size.height / 4); | |
var secondEndPoint = Offset(size.width / 1.5, size.height / 5); | |
path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy, | |
secondEndPoint.dx, secondEndPoint.dy); | |
var thirdControlPoint = | |
Offset(size.width - (size.width / 9), size.height / 6); | |
var thirdEndPoint = Offset(size.width, 0.0); | |
path.quadraticBezierTo(thirdControlPoint.dx, thirdControlPoint.dy, | |
thirdEndPoint.dx, thirdEndPoint.dy); | |
///move from bottom right to top | |
path.lineTo(size.width, 0.0); | |
///finally close the path by reaching start point from top right corner | |
path.close(); | |
return path; | |
} | |
@override | |
bool shouldReclip(CustomClipper<Path> oldClipper) => false; | |
} | |
class FooterWaveClipper extends CustomClipper<Path> { | |
@override | |
Path getClip(Size size) { | |
var path = Path(); | |
path.moveTo(size.width, 0.0); | |
path.lineTo(size.width, size.height); | |
path.lineTo(0.0, size.height); | |
path.lineTo(0.0, size.height - 60); | |
var secondControlPoint = Offset(size.width - (size.width / 6), size.height); | |
var secondEndPoint = Offset(size.width, 0.0); | |
path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy, | |
secondEndPoint.dx, secondEndPoint.dy); | |
return path; | |
} | |
@override | |
bool shouldReclip(CustomClipper<Path> oldClipper) => false; | |
} | |
class YellowCircleClipper extends CustomClipper<Rect> { | |
@override | |
Rect getClip(Size size) { | |
return null; | |
} | |
@override | |
bool shouldReclip(CustomClipper<Rect> oldClipper) => false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class DialogonalClipper extends CustomClipper<Path> { | |
@override | |
Path getClip(Size size) { | |
Path path = new Path(); | |
path.lineTo(0.0, size.height - 60.0); | |
path.lineTo(size.width, size.height); | |
path.lineTo(size.width, 0.0); | |
path.close(); | |
return path; | |
} | |
@override | |
bool shouldReclip(CustomClipper<Path> oldClipper) => true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/cupertino.dart'; | |
import 'package:flutter/gestures.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/painting.dart'; | |
import 'package:project/gui/page/inputWidget.dart'; | |
import 'dart:async'; | |
import 'dart:convert'; | |
import 'package:http/http.dart' as http; | |
class email extends StatefulWidget { | |
const email({Key key}) : super(key: key); | |
@override | |
page createState() => page(); | |
} | |
class page extends State<email> { | |
@override | |
Widget build(BuildContext context) { | |
final _width = MediaQuery.of(context).size.width; | |
final _height = MediaQuery.of(context).size.height; | |
return Scaffold( | |
appBar: AppBar( | |
backgroundColor: Colors.deepPurple, | |
title:Text('Preview Your New email'), | |
), | |
backgroundColor: Colors.white, | |
body: new ListView( | |
children: <Widget>[ | |
new Card( | |
margin: EdgeInsets.all(10), | |
elevation: 20, | |
child: new Column( | |
children: <Widget>[ | |
new SizedBox( | |
height: _height / 40, | |
), | |
InputWidget(50.0, 0.0, 40, "new email"), | |
InputWidget(0.0, 0.0, 40, "new email"), | |
new Container( | |
width: _width, | |
child: new Text( | |
"To save this setting,please enter your password", | |
style: TextStyle( | |
fontSize: 20, | |
fontWeight: FontWeight.w300, | |
), | |
), | |
), | |
new SizedBox( | |
height: _height / 32, | |
), | |
InputWidget(00.0, 50.0, 25, "pssword"), | |
RaisedButton( | |
onPressed: () {}, | |
highlightColor: Colors.deepOrange, | |
textColor: Colors.white, | |
padding: const EdgeInsets.all(0.0), | |
child: Container( | |
decoration: const BoxDecoration( | |
gradient: LinearGradient( | |
colors: <Color>[ | |
Color(0xFF0D47A1), | |
Color(0xFF1976D2), | |
Color(0xFF42A5F5), | |
], | |
), | |
), | |
padding: const EdgeInsets.all(10.0), | |
child: const Text('Save Changes', | |
style: TextStyle(fontSize: 20)), | |
), | |
), | |
], | |
), | |
), | |
], | |
), | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'task.dart'; | |
import 'package:flutter/material.dart'; | |
List<Task> tasks = [ | |
new Task( | |
name: "AAST", | |
category: "Maritime Transport & Technology", | |
time: "5pm", | |
color: Colors.orange, | |
completed: 50), | |
new Task( | |
name: "AAST", | |
category: "Engineering & Technology", | |
time: "3pm", | |
color: Colors.cyan, | |
completed: 100), | |
new Task( | |
name: "AAST", | |
category: "Management & Technology", | |
time: "2pm", | |
color: Colors.pink, | |
completed: 120), | |
new Task( | |
name: "AAST", | |
category: "Engineering & Technology", | |
time: "12pm", | |
color: Colors.cyan, | |
completed: 150), | |
new Task( | |
name: "AAST", | |
category: "Computing & Information Technology", | |
time: "10am", | |
color: Colors.cyan, | |
completed: 170), | |
new Task( | |
name: "AAST", | |
category: "Maritime Transport & Technology", | |
time: "5pm", | |
color: Colors.orange, | |
completed: 200), | |
new Task( | |
name: "AAST", | |
category: "Engineering & Technology", | |
time: "3pm", | |
color: Colors.cyan, | |
completed: 230), | |
new Task( | |
name: "AAST", | |
category: "Management & Technology", | |
time: "2pm", | |
color: Colors.pink, | |
completed: 260), | |
new Task( | |
name: "AAST", | |
category: "Engineering & Technology", | |
time: "12pm", | |
color: Colors.cyan, | |
completed: 290), | |
new Task( | |
name: "AAST", | |
category: "Computing & Information Technology", | |
time: "10am", | |
color: Colors.cyan, | |
completed: 320), | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class InputWidget extends StatelessWidget { | |
final double topRight; | |
final double bottomRight; | |
final int max; | |
final String back; | |
String error =null; | |
int line=1; | |
InputWidget(this.topRight, this.bottomRight,this.max,this.back,[this.error,this.line]); | |
@override | |
Widget build(BuildContext context) { | |
return Padding( | |
padding: EdgeInsets.only(right: 40, bottom: 30), | |
child: Container( | |
width: MediaQuery.of(context).size.width - 40, | |
child: Material( | |
elevation: 10, | |
color: Colors.white, | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.only( | |
bottomRight: Radius.circular(bottomRight), | |
topRight: Radius.circular(topRight))), | |
child: Padding( | |
padding: EdgeInsets.only(left: 40, right: 20, top: 10, bottom: 10), | |
child: TextField( | |
maxLines: line, | |
maxLength: max, | |
keyboardType:TextInputType.emailAddress, | |
decoration: InputDecoration( | |
border: InputBorder.none, | |
errorText: error !=null ? error : null, | |
hintText: back, | |
hintStyle: TextStyle(color: Color(0xFFE1E1E1), fontSize: 14)), | |
), | |
), | |
), | |
), | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'task.dart'; | |
import 'task_row.dart'; | |
import 'package:flutter/material.dart'; | |
class ListModel { | |
ListModel(this.listKey, items) : this.items = new List.of(items); | |
final GlobalKey<AnimatedListState> listKey; | |
final List<Task> items; | |
AnimatedListState get _animatedList => listKey.currentState; | |
void insert(int index, Task item) { | |
items.insert(index, item); | |
_animatedList.insertItem(index, duration: new Duration(milliseconds: 150)); | |
} | |
Task removeAt(int index) { | |
final Task removedItem = items.removeAt(index); | |
if (removedItem != null) { | |
_animatedList.removeItem( | |
index, | |
(context, animation) => new TaskRow( | |
task: removedItem, | |
animation: animation, | |
), | |
duration: new Duration(milliseconds: (150 + 200*(index/length)).toInt()) | |
); | |
} | |
return removedItem; | |
} | |
int get length => items.length; | |
Task operator [](int index) => items[index]; | |
int indexOf(Task item) => items.indexOf(item); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter/painting.dart'; | |
import 'dart:async'; | |
import 'dart:convert'; | |
import 'package:http/http.dart' as http; | |
import 'dart:ui' as ui; | |
import 'package:flutter_rating_bar/flutter_rating_bar.dart'; | |
String newRouteName; | |
int admin = 0; | |
int index=0; | |
String move_nav(String newRouteName,int admin,int ind){ | |
if (ind == 1 && admin == 0) | |
newRouteName = "/2"; | |
else if (ind == 2 && admin == 0) | |
newRouteName = "/3"; | |
else if (ind == 0 && admin == 0) | |
newRouteName=null; | |
else if (ind == 1 && admin == 1) newRouteName = "/3"; | |
else if(ind==0){ | |
newRouteName=null; | |
} | |
print("hi ${newRouteName} $ind $admin");return newRouteName; | |
} | |
void move(String newRouteName_,BuildContext context){ | |
Navigator.of(context).pushNamedAndRemoveUntil(newRouteName_, (Route<dynamic> route) => false); | |
} | |
class My extends StatefulWidget { | |
My({Key key, this.title}) : super(key: key); | |
final String title; | |
@override | |
_MyHomePageState createState() => new _MyHomePageState(); | |
} | |
class _MyHomePageState extends State<My> { | |
Map data; | |
List userData; | |
Future getdata() async { | |
http.Response response = | |
await http.get("https://reqres.in/api/users?page=2"); | |
data = json.decode(response.body); | |
print(data); | |
setState(() { | |
userData = data["data"]; | |
}); | |
} | |
@override | |
Widget build(BuildContext context) { | |
Widget native(BuildContext context) { | |
if (admin == 0) { | |
return new BottomNavigationBar( | |
backgroundColor: Colors.blueAccent, | |
type: BottomNavigationBarType.fixed, | |
fixedColor: Colors.yellowAccent, | |
currentIndex: index , | |
onTap: (int ind) { | |
setState(() { | |
newRouteName=move_nav(newRouteName,admin,ind); | |
}); | |
move(newRouteName,context); | |
/*_navigateToScreens(index);*/ | |
print(newRouteName); | |
}, | |
items: [ | |
new BottomNavigationBarItem( | |
icon: new Icon(Icons.home), | |
title: new Text("Home"), | |
), | |
new BottomNavigationBarItem( | |
icon: new Icon(Icons.add_circle), | |
title: new Text("add new"), | |
), | |
new BottomNavigationBarItem( | |
icon: new Icon(Icons.settings), | |
title: new Text("settings"), | |
), | |
], | |
); | |
} else { | |
return new BottomNavigationBar( | |
backgroundColor: Colors.blueAccent, | |
type: BottomNavigationBarType.fixed, | |
fixedColor: Colors.yellowAccent, | |
currentIndex: index, | |
onTap: (int ind) { | |
setState(() { | |
newRouteName=move_nav(newRouteName,admin,ind); | |
}); | |
/*_navigateToScreens(index);*/ | |
move(newRouteName,context); | |
/*_navigateToScreens(index);*/ | |
print(newRouteName); | |
}, | |
items: [ | |
new BottomNavigationBarItem( | |
icon: new Icon(Icons.home), | |
title: new Text("Home"), | |
), | |
new BottomNavigationBarItem( | |
icon: new Icon(Icons.settings), | |
title: new Text("settings"), | |
), | |
], | |
); | |
} | |
} | |
final _width = MediaQuery.of(context).size.width; | |
final _height = MediaQuery.of(context).size.height; | |
final String imgUrl = | |
'https://pixel.nymag.com/imgs/daily/selectall/2017/12/26/26-eric-schmidt.w700.h700.jpg'; | |
final GlobalKey<RefreshIndicatorState> _refreshIndicatorKey = | |
new GlobalKey<RefreshIndicatorState>(); | |
return new Stack( | |
children: <Widget>[ | |
new Container( | |
color: Colors.blue, | |
), | |
new Image.network( | |
"https://upload.wikimedia.org/wikipedia/commons/d/da/AASTMT_Logo.png", | |
fit: BoxFit.cover, | |
height: 500, | |
), | |
new BackdropFilter( | |
filter: new ui.ImageFilter.blur( | |
sigmaX: 1.0, | |
sigmaY: 1.0, | |
), | |
child: new Container( | |
decoration: BoxDecoration( | |
color: Colors.blue.withOpacity(0.5), | |
borderRadius: BorderRadius.all(Radius.circular(50.0)), | |
), | |
)), | |
new Scaffold( | |
appBar: AppBar( | |
backgroundColor: Colors.deepPurple, | |
), | |
bottomNavigationBar: native(context), | |
drawer: admin_button(), | |
backgroundColor: Colors.transparent, | |
body:new RefreshIndicator( | |
color: Colors.blue, | |
key: _refreshIndicatorKey, | |
onRefresh: getdata, | |
child: new ListView( | |
children: <Widget>[ | |
new Column( | |
children: <Widget>[ | |
new SizedBox( | |
height: _height / 8.5, | |
), | |
new CircleAvatar( | |
radius: _width < _height ? _width / 4 : _height / 4, | |
backgroundImage: NetworkImage(imgUrl), | |
), | |
new SizedBox( | |
height: _height / 25.0, | |
), | |
new Text( | |
'Yousseff muhammed', | |
style: new TextStyle( | |
fontWeight: FontWeight.bold, | |
fontSize: _width / 15, | |
color: Colors.white), | |
), | |
new Padding( | |
padding: new EdgeInsets.only( | |
top: _height / 30, left: _width / 8, right: _width / 8), | |
child: new Text( | |
'17101264 \n computer engineer student at aast ', | |
style: new TextStyle( | |
fontWeight: FontWeight.normal, | |
fontSize: _width / 25, | |
color: Colors.white), | |
textAlign: TextAlign.center, | |
), | |
), | |
new Divider( | |
height: _height / 30, | |
color: Colors.white, | |
), | |
extra_data(), | |
new Divider(height: _height / 30, color: Colors.white), | |
//admin_button(22, "s"), | |
], | |
), | |
setingBox("Phone Number", "015 503 212 53", "/3", context), | |
setingBox("Phone Number", "015 503 212 53", "/3", context), | |
setingBox("Phone Number", "015 503 212 53", "/3", context), | |
setingBox("Phone Number", "015 503 212 53", "/3", context), | |
setingBox("Phone Number", "015 503 212 53", "/3", context), | |
setingBox("Phone Number", "015 503 212 53", "/3", context), | |
setingBox("Phone Number", "015 503 212 53", "/3", context), | |
], | |
), | |
), | |
), | |
], | |
); | |
} | |
Widget rowCell(int count, String type) => new Expanded( | |
child: new Column( | |
children: <Widget>[ | |
new Text( | |
'$count', | |
style: new TextStyle(color: Colors.white), | |
), | |
new Text(type, | |
style: new TextStyle( | |
color: Colors.white, fontWeight: FontWeight.normal)) | |
], | |
)); | |
Widget admin_button() { | |
final MediaQueryData mediaQuery = MediaQuery.of(context); | |
final ThemeData themeData = Theme.of(context); | |
if (admin == 1) { | |
return new Drawer( | |
child: new Drawer( | |
child: new ListView( | |
primary: false, | |
children: <Widget>[ | |
new Container( | |
// Fake a drawer header | |
color: Colors.deepPurpleAccent, | |
padding: new EdgeInsets.only( | |
top: mediaQuery.padding.top + 0.0, bottom: 0.0), | |
child: new ListTile( | |
leading: new Icon(Icons.android, | |
color: themeData.primaryTextTheme.title.color), | |
title: new Text('admin', | |
style: themeData.primaryTextTheme.title), | |
), | |
), | |
new Divider(color: Colors.deepPurple), | |
ListTile( | |
leading: Icon(Icons.code), | |
title: Text('invitation code generation'), | |
onTap: () { | |
Navigator.pop(context); | |
}, | |
), | |
new Divider(color: Colors.deepPurple), | |
ListTile( | |
leading: Icon(Icons.add_circle_outline), | |
title: Text('New admin request'), | |
onTap: () { | |
Navigator.pop(context); | |
}, | |
), | |
new Divider(color: Colors.deepPurple), | |
ListTile( | |
leading: Icon(Icons.accessibility), | |
title: Text('new member requests'), | |
onTap: () { | |
Navigator.pop(context); | |
}, | |
), | |
new Divider(color: Colors.deepPurple), | |
ListTile( | |
leading: Icon(Icons.add_alert), | |
title: Text('adding a new event'), | |
onTap: () { | |
Navigator.pop(context); | |
}, | |
), | |
new Divider(color: Colors.deepPurple), | |
ListTile( | |
leading: Icon(Icons.announcement), | |
title: Text('my active events'), | |
onTap: () { | |
Navigator.pop(context); | |
}, | |
), | |
new Divider(color: Colors.deepPurple), | |
], | |
), | |
), | |
); | |
} | |
} | |
Widget rate() { | |
if (admin == 0) { | |
return (new FlutterRatingBar( | |
/*data from cloud*/ | |
initialRating: 3.8, | |
fillColor: Colors.amber, | |
borderColor: Colors.amber.withAlpha(50), | |
allowHalfRating: false, | |
tapOnlyMode: false, | |
)); | |
} | |
} | |
Widget extra_data() { | |
if (admin == 0) { | |
return (new Row( | |
children: <Widget>[ | |
rowCell(343, 'prev active'), | |
new Column( | |
children: <Widget>[ | |
new Center( | |
child: new Text( | |
"3.8", | |
style: new TextStyle( | |
color: Colors.white, fontWeight: FontWeight.normal), | |
), | |
), | |
rate(), | |
], | |
), | |
rowCell(673826, 'active'), | |
], | |
)); | |
} else { | |
return new Row( | |
children: <Widget>[ | |
rowCell(343, 'prev active'), | |
rowCell(67, 'admin request'), | |
rowCell(673826, 'active'), | |
rowCell(6, 'enroll request'), | |
], | |
); | |
} | |
} | |
} | |
Widget setingBox(String name, String data, String r, BuildContext context ) { | |
return Card( | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.all(Radius.circular(0.0)), | |
), | |
margin: EdgeInsets.only(left: 8.0, right: 8.0, top: 0.5), | |
child: Container( | |
height: 80.0, | |
padding: EdgeInsets.only(left: 16.0, top: 16.0, bottom: 0.0), | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: <Widget>[ | |
Flexible( | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
mainAxisAlignment: MainAxisAlignment.spaceAround, | |
children: <Widget>[ | |
Text( | |
name, | |
style: TextStyle( | |
fontWeight: FontWeight.w900, | |
fontSize: 25, | |
), | |
maxLines: 1, | |
overflow: TextOverflow.ellipsis, | |
), | |
Text( | |
data, | |
style: TextStyle( | |
fontWeight: FontWeight.w400, | |
), | |
maxLines: 1, | |
overflow: TextOverflow.ellipsis, | |
), | |
], | |
), | |
), | |
IconButton( | |
onPressed: ()=>move(r, context), | |
icon: Icon( | |
Icons.arrow_forward_ios, | |
size: 23.0, | |
color: Colors.blue[600] , | |
), | |
), | |
], | |
), | |
), | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/cupertino.dart'; | |
import 'package:flutter/gestures.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/painting.dart'; | |
import 'package:project/gui/page/inputWidget.dart'; | |
import 'dart:async'; | |
import 'dart:convert'; | |
import 'package:http/http.dart' as http; | |
class password extends StatefulWidget { | |
const password({Key key}) : super(key: key); | |
@override | |
page createState() => page(); | |
} | |
class page extends State<password> { | |
@override | |
Widget build(BuildContext context) { | |
final _width = MediaQuery.of(context).size.width; | |
final _height = MediaQuery.of(context).size.height; | |
return Scaffold( | |
appBar: AppBar( | |
backgroundColor: Colors.deepPurple, | |
title:Text('Preview Your New password'), | |
), | |
backgroundColor: Colors.white, | |
body: new ListView( | |
children: <Widget>[ | |
new Card( | |
margin: EdgeInsets.all(10), | |
elevation: 20, | |
child: new Column( | |
children: <Widget>[ | |
new SizedBox( | |
height: _height / 40, | |
), | |
InputWidget(50.0, 0.0, 20, "new password"), | |
InputWidget(0.0, 0.0, 20, "new password"), | |
new Container( | |
width: _width, | |
child: new Text( | |
"To save this setting,please enter your password", | |
style: TextStyle( | |
fontSize: 20, | |
fontWeight: FontWeight.w300, | |
), | |
), | |
), | |
new SizedBox( | |
height: _height / 32, | |
), | |
InputWidget(00.0, 50.0, 25, "old pssword"), | |
RaisedButton( | |
onPressed: () {}, | |
highlightColor: Colors.deepOrange, | |
textColor: Colors.white, | |
padding: const EdgeInsets.all(0.0), | |
child: Container( | |
decoration: const BoxDecoration( | |
gradient: LinearGradient( | |
colors: <Color>[ | |
Color(0xFF0D47A1), | |
Color(0xFF1976D2), | |
Color(0xFF42A5F5), | |
], | |
), | |
), | |
padding: const EdgeInsets.all(10.0), | |
child: const Text('Save Changes', | |
style: TextStyle(fontSize: 20)), | |
), | |
), | |
], | |
), | |
), | |
], | |
), | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/cupertino.dart'; | |
import 'package:flutter/gestures.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/painting.dart'; | |
import 'package:project/gui/page/inputWidget.dart'; | |
import 'dart:async'; | |
import 'dart:convert'; | |
import 'package:http/http.dart' as http; | |
class phone extends StatefulWidget { | |
const phone({Key key}) : super(key: key); | |
@override | |
page createState() => page(); | |
} | |
class page extends State<phone> { | |
@override | |
Widget build(BuildContext context) { | |
final _width = MediaQuery.of(context).size.width; | |
final _height = MediaQuery.of(context).size.height; | |
return Scaffold( | |
appBar: AppBar( | |
backgroundColor: Colors.deepPurple, | |
title:Text(' Preview Your New phone'), | |
), | |
backgroundColor: Colors.white, | |
body: new ListView( | |
children: <Widget>[ | |
new Card( | |
margin: EdgeInsets.all(10), | |
elevation: 20, | |
child: new Column( | |
children: <Widget>[ | |
new SizedBox( | |
height: _height / 40, | |
), | |
InputWidget(50.0, 0.0, 40, "phone nymber"), | |
InputWidget(0.0, 0.0, 40, "phone nymber"), | |
new Container( | |
width: _width, | |
child: new Text( | |
"To save this setting,please enter your password", | |
style: TextStyle( | |
fontSize: 20, | |
fontWeight: FontWeight.w300, | |
), | |
), | |
), | |
new SizedBox( | |
height: _height / 32, | |
), | |
InputWidget(00.0, 50.0, 25, "pssword"), | |
RaisedButton( | |
onPressed: () {}, | |
highlightColor: Colors.deepOrange, | |
textColor: Colors.white, | |
padding: const EdgeInsets.all(0.0), | |
child: Container( | |
decoration: const BoxDecoration( | |
gradient: LinearGradient( | |
colors: <Color>[ | |
Color(0xFF0D47A1), | |
Color(0xFF1976D2), | |
Color(0xFF42A5F5), | |
], | |
), | |
), | |
padding: const EdgeInsets.all(10.0), | |
child: const Text('Save Changes', | |
style: TextStyle(fontSize: 20)), | |
), | |
), | |
], | |
), | |
), | |
], | |
), | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:io'; | |
import 'package:project/gui/page/inputWidget.dart'; | |
import 'package:flutter/cupertino.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:image_picker/image_picker.dart'; | |
class photo extends StatefulWidget { | |
@override | |
State<StatefulWidget> createState() { | |
return new photoState(); | |
} | |
} | |
int selected=0; | |
class photoState extends State<photo> { | |
//save the result of gallery file | |
File galleryFile; | |
//save the result of camera file | |
File cameraFile; | |
// | |
@override | |
Widget build(BuildContext context) { | |
final _width = MediaQuery.of(context).size.width; | |
final _height = MediaQuery.of(context).size.height; | |
//display image selected from gallery | |
imageSelectorGallery() async { | |
galleryFile = await ImagePicker.pickImage( | |
source: ImageSource.gallery, | |
// maxHeight: 50.0, | |
// maxWidth: 50.0, | |
); | |
print("You selected gallery image : " + galleryFile.path); | |
setState(() { selected=0; | |
}); | |
} | |
//display image selected from camera | |
imageSelectorCamera() async { | |
cameraFile = await ImagePicker.pickImage( | |
source: ImageSource.camera, | |
//maxHeight: 50.0, | |
//maxWidth: 50.0, | |
); | |
print("You selected camera image : " + cameraFile.path); | |
setState(() { selected=1; | |
}); | |
} | |
return new Scaffold( | |
appBar: new AppBar( | |
title: new Text('profile pcture'), | |
), | |
body: new ListView( | |
children: <Widget>[ | |
new Card( | |
margin: EdgeInsets.all(10), | |
elevation: 20, | |
child: new Column( | |
children: <Widget>[ | |
new SizedBox( | |
height: _height / 40, | |
), | |
new Builder( | |
builder: (BuildContext context) { | |
return new Column( | |
mainAxisAlignment: MainAxisAlignment.spaceAround, | |
children: <Widget>[ | |
selected == 1 ? displaySelectedFile(cameraFile): | |
displaySelectedFile(galleryFile), | |
new SizedBox( | |
height: _height / 32, | |
), | |
button("Select Image from Gallery", imageSelectorGallery, Icons.insert_photo), | |
button("Select Image from Camera", imageSelectorCamera,Icons.camera_alt), | |
], | |
); | |
}, | |
), | |
new SizedBox( | |
height: _height / 40, | |
), | |
new Container( | |
width: _width, | |
child: new Text( | |
"To save this setting,please enter your password", | |
style: TextStyle( | |
fontSize: 20, | |
fontWeight: FontWeight.w300, | |
), | |
), | |
), | |
new SizedBox( | |
height: _height / 32, | |
), | |
InputWidget(00.0, 50.0, 25, "pssword"), | |
RaisedButton( | |
onPressed: () {}, | |
textColor: Colors.white, | |
padding: const EdgeInsets.all(0.0), | |
child: Container( | |
decoration: const BoxDecoration( | |
gradient: LinearGradient( | |
colors: <Color>[ | |
Color(0xFF0D47A1), | |
Color(0xFF1976D2), | |
Color(0xFF42A5F5), | |
], | |
), | |
), | |
padding: const EdgeInsets.all(10.0), | |
child: const Text('Save Changes', | |
style: TextStyle(fontSize: 20)), | |
), | |
), | |
], | |
), | |
), | |
], | |
), | |
); | |
} | |
Widget displaySelectedFile(File file) { | |
final _width = MediaQuery.of(context).size.width; | |
final _height = MediaQuery.of(context).size.height; | |
return new CircleAvatar( | |
radius: _width < _height ? _width / 4 : _height / 4, | |
//child: new Card(child: new Text(''+galleryFile.toString())), | |
//child: new Image.file(galleryFile), | |
child: | |
file == null ? new Text('No image selected.') | |
: new CircleAvatar(backgroundImage: new FileImage(file), radius: _width,), | |
); | |
} | |
Widget button(String name_, x,c) | |
{ | |
return RaisedButton( | |
onPressed: x, | |
textColor: Colors.white, | |
padding: const EdgeInsets.all(0.0), | |
child: Container( | |
decoration: const BoxDecoration( | |
gradient: LinearGradient( | |
colors: <Color>[ | |
Colors.orange, | |
Colors.deepOrange, | |
Colors.red, | |
], | |
), | |
), | |
padding: const EdgeInsets.all(10.0), | |
child: Row( | |
children: <Widget>[ | |
Icon(c), | |
Text('$name_', style: TextStyle(fontSize: 20)), | |
], | |
), | |
), | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/cupertino.dart'; | |
import 'package:flutter/gestures.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/painting.dart'; | |
import 'package:project/gui/page/inputWidget.dart'; | |
import 'dart:async'; | |
import 'dart:convert'; | |
import 'package:http/http.dart' as http; | |
class report extends StatefulWidget { | |
const report({Key key}) : super(key: key); | |
@override | |
page createState() => page(); | |
} | |
class page extends State<report> { | |
@override | |
Widget build(BuildContext context) { | |
final _width = MediaQuery.of(context).size.width; | |
final _height = MediaQuery.of(context).size.height; | |
return Scaffold( | |
appBar: AppBar( | |
backgroundColor: Colors.deepPurple, | |
title:Text('Report a problem'), | |
), | |
backgroundColor: Colors.white, | |
body: new ListView( | |
children: <Widget>[ | |
new Card( | |
margin: EdgeInsets.all(10), | |
elevation: 20, | |
child: new Column( | |
children: <Widget>[ | |
new SizedBox( | |
height: _height / 40, | |
), | |
InputWidget(50.0, 0.0, 1000, "Feed Back",null,30), | |
RaisedButton( | |
onPressed: () {}, | |
highlightColor: Colors.deepOrange, | |
textColor: Colors.white, | |
padding: const EdgeInsets.all(0.0), | |
child: Container( | |
decoration: const BoxDecoration( | |
gradient: LinearGradient( | |
colors: <Color>[ | |
Colors.redAccent, | |
Colors.redAccent, | |
Colors.deepOrangeAccent, | |
Colors.deepOrangeAccent, | |
], | |
), | |
), | |
padding: const EdgeInsets.all(10.0), | |
child: const Text('Report', | |
style: TextStyle(fontSize: 20)), | |
), | |
), | |
], | |
), | |
), | |
], | |
), | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter/services.dart'; | |
import 'package:project/gui/page/MyApp.dart' as prefix0; | |
import 'package:project/gui/page/background.dart'; | |
import 'dart:io'; | |
class start extends StatefulWidget { | |
@override | |
State<StatefulWidget> createState() { | |
return _logState(); | |
} | |
} | |
class _logState extends State<start> { | |
void move(String newRouteName_, BuildContext context) { | |
Navigator.of(context).pushNamedAndRemoveUntil( | |
newRouteName_, (Route<dynamic> route) => false); | |
} | |
// f45d27 | |
// f5851f | |
@override | |
void initState() { | |
SystemChrome.setEnabledSystemUIOverlays([]); | |
super.initState(); | |
} | |
Color color = Color(0xFF4169E1); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
backgroundColor: Colors.lightBlueAccent, | |
body: new ListView( | |
children: <Widget>[ | |
Container( | |
decoration: BoxDecoration( | |
gradient: LinearGradient( | |
begin: Alignment.topCenter, | |
end: Alignment.bottomCenter, | |
colors: [ | |
Colors.purple, | |
Colors.lightBlueAccent, | |
], | |
), | |
borderRadius: | |
BorderRadius.only(bottomLeft: Radius.circular(470))), | |
width: MediaQuery.of(context).size.width, | |
height: MediaQuery.of(context).size.height, | |
child: Stack( | |
overflow: Overflow.visible, | |
children: <Widget>[ | |
WavyHeader(), | |
Container( | |
child: Column( | |
children: <Widget>[ | |
new SizedBox( | |
height: MediaQuery.of(context).size.height / 2.0, | |
), | |
Container( | |
width: MediaQuery.of(context).size.width / 1.2, | |
height: 45, | |
padding: EdgeInsets.only( | |
top: 4, left: 16, right: 16, bottom: 4), | |
decoration: BoxDecoration( | |
borderRadius: BorderRadius.all(Radius.circular(50)), | |
color: Colors.white, | |
boxShadow: [ | |
BoxShadow(color: Colors.black12, blurRadius: 5) | |
]), | |
child: TextField( | |
decoration: InputDecoration( | |
border: InputBorder.none, | |
icon: Icon( | |
Icons.email, | |
color: Colors.grey, | |
), | |
hintText: 'Email', | |
), | |
), | |
), | |
new SizedBox( | |
height: MediaQuery.of(context).size.height / 25.0, | |
), | |
Container( | |
width: MediaQuery.of(context).size.width / 1.2, | |
height: 45, | |
padding: EdgeInsets.only( | |
top: 4, left: 16, right: 16, bottom: 4), | |
decoration: BoxDecoration( | |
borderRadius: BorderRadius.all(Radius.circular(50)), | |
color: Colors.white, | |
boxShadow: [ | |
BoxShadow(color: Colors.black12, blurRadius: 5) | |
]), | |
child: TextField( | |
decoration: InputDecoration( | |
border: InputBorder.none, | |
icon: Icon( | |
Icons.vpn_key, | |
color: Colors.grey, | |
), | |
hintText: 'password', | |
), | |
), | |
), | |
Align( | |
alignment: Alignment.centerRight, | |
child: Padding( | |
padding: const EdgeInsets.only(top: 16, right: 32), | |
child: Text( | |
'Forgot Password ?', | |
style: TextStyle(color: Colors.amber), | |
), | |
), | |
), | |
new SizedBox( | |
height: MediaQuery.of(context).size.height / 60.0, | |
), | |
InkWell( | |
focusColor: Colors.amber, | |
highlightColor: Colors.white, | |
onTap: () => move("/0", context), | |
child: Container( | |
height: 45, | |
width: MediaQuery.of(context).size.width / 1.2, | |
decoration: BoxDecoration( | |
gradient: LinearGradient( | |
colors: [ | |
color, | |
color, | |
], | |
), | |
borderRadius: | |
BorderRadius.all(Radius.circular(50))), | |
child: Center( | |
child: Text( | |
'Login'.toUpperCase(), | |
style: TextStyle( | |
color: Colors.white, | |
fontWeight: FontWeight.bold), | |
), | |
), | |
), | |
), | |
new SizedBox( | |
height: MediaQuery.of(context).size.height / 60.0, | |
), | |
Container( | |
height: 45, | |
width: MediaQuery.of(context).size.width / 1.2, | |
decoration: BoxDecoration( | |
gradient: LinearGradient( | |
colors: [ | |
Color(0xFF4169E1), | |
Color(0xFF4169E1), | |
], | |
), | |
borderRadius: | |
BorderRadius.all(Radius.circular(50))), | |
child: Center( | |
child: Text( | |
'create a new account'.toUpperCase(), | |
style: TextStyle( | |
color: Colors.white, | |
fontWeight: FontWeight.bold), | |
), | |
), | |
), | |
], | |
), | |
), | |
], | |
), | |
), | |
], | |
), | |
); | |
} | |
} | |
Widget button(BuildContext context, String name) => (new InkWell( | |
onTap: () => print('hello'), | |
child: Column( | |
children: <Widget>[ | |
Container( | |
height: 45, | |
width: MediaQuery.of(context).size.width / 1.2, | |
decoration: BoxDecoration( | |
gradient: LinearGradient( | |
colors: [Color(0xFFf45d27), Color(0xFFf5851f)], | |
), | |
borderRadius: BorderRadius.all(Radius.circular(50))), | |
child: Center( | |
child: Text( | |
name.toUpperCase(), | |
style: | |
TextStyle(color: Colors.white, fontWeight: FontWeight.bold), | |
), | |
), | |
), | |
], | |
), | |
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class Task { | |
final String name; | |
final String category; | |
final String time; | |
final Color color; | |
final double completed; | |
Task({this.name, this.category, this.time, this.color, this.completed}); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:project/gui/page/initial_list.dart'; | |
import 'task.dart'; | |
import 'package:flutter/material.dart'; | |
import 'dart:core'; | |
class TaskRow extends StatelessWidget { | |
final Task task; | |
final double dotSize = 12.0; | |
final Animation<double> animation; | |
const TaskRow({Key key, this.task, this.animation}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return new FadeTransition( | |
opacity: animation, | |
child: new SizeTransition( | |
sizeFactor: animation, | |
child: Card( | |
margin: EdgeInsets.only(left: 40.0, right: 8.0, top: 0.5), | |
child:InkWell( | |
onTap: ()=>print("s"), | |
focusColor: Colors.amber, | |
child: new Padding( | |
padding: const EdgeInsets.symmetric(vertical: 16.0), | |
child: new Row( | |
children: <Widget>[ | |
new Padding( | |
padding: | |
new EdgeInsets.symmetric(horizontal: 32.0 - dotSize / 2), | |
child: new Container( | |
height: dotSize*5, | |
width: dotSize*7, | |
decoration: new BoxDecoration( | |
shape: BoxShape.circle, color: Color.fromRGBO(128, 222, 243, 200)), | |
child: new Stack( | |
alignment: Alignment.center, | |
children: <Widget>[ | |
new CustomPaint( | |
painter: new CircularCanvas(progress: task.completed, backgroundColor:Colors.white,color: color_progress(((task.completed/360)*100).toInt())), | |
size: new Size(50,50), | |
), | |
new Text('${((task.completed/360)*100).toInt().round()}%', | |
style: new TextStyle(color: Colors.deepPurple, fontSize: 18, fontWeight: FontWeight.bold),), | |
],), | |
), | |
), | |
new Expanded( | |
child: new Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: <Widget>[ | |
new Text( | |
task.name, | |
style: new TextStyle(fontSize: 20.0), | |
), | |
new Text( | |
task.category, | |
style: new TextStyle(fontSize: 15.0, color: Colors.grey), | |
) | |
], | |
), | |
), | |
new Padding( | |
padding: const EdgeInsets.only(right: 16.0), | |
child: new Text( | |
task.time, | |
style: new TextStyle(fontSize: 12.0, color: Colors.grey), | |
), | |
), | |
], | |
), | |
), | |
), | |
), | |
), | |
); | |
} | |
} | |
class CircularCanvas extends CustomPainter{ | |
final double progress; | |
final Color backgroundColor; | |
final Color color; | |
CircularCanvas({this.progress, this.backgroundColor = Colors.grey, this.color = Colors.blue}); | |
@override | |
void paint(Canvas canvas, Size size) { | |
var strokeWidth = size.width/8.5; | |
var paint = new Paint(); | |
paint..color = backgroundColor | |
..strokeCap = StrokeCap.round | |
..style = PaintingStyle.fill; | |
canvas.drawCircle(new Offset(size.width/2, size.height/2), size.width/1.9, paint); | |
paint..strokeWidth = strokeWidth | |
..style = PaintingStyle.stroke; | |
canvas.drawArc(new Offset(strokeWidth/2, strokeWidth/2) | |
&new Size(size.width - strokeWidth, size.width - strokeWidth), -90.0*0.0174533, progress*0.0174533, | |
false, paint..color = color/* */); | |
} | |
@override | |
bool shouldRepaint(CircularCanvas oldDelegate) { | |
return oldDelegate.progress !=progress; | |
} | |
} | |
Color color_progress(int data){ | |
if (data <=20 ){ | |
return Colors.lightGreenAccent; | |
}else if (data <=40){ | |
return Colors.lightGreenAccent; | |
}else if (data <=60){ | |
return Colors.deepOrange; | |
}else if(data <=80){ | |
return Colors.deepOrangeAccent; | |
}else{ | |
return Colors.red; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment