Last active
July 4, 2020 08:27
-
-
Save ialameh/6e2b9d879ca5075a59cde4d8bf46799d to your computer and use it in GitHub Desktop.
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:provider/provider.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter_form_builder/flutter_form_builder.dart'; | |
import '../provider/chat_provider.dart'; | |
class Showing extends StatelessWidget { | |
static const routedname='/showing'; | |
final GlobalKey<FormBuilderState> _fbKey = GlobalKey<FormBuilderState>(); | |
@override | |
Widget build(BuildContext context) { | |
return Consumer<ChatProvider>( | |
builder: (context, _, child) { | |
return Scaffold( | |
appBar: AppBar(title: Text('Showing')), | |
body:FormBuilder ( | |
key: _fbKey, | |
child: Column(children: [ | |
Text('${_.grade}'), | |
FormBuilderTextField(attribute: 'grade',), | |
FlatButton(onPressed: () { | |
if(_fbKey.currentState.saveAndValidate()){ | |
int thisgrade = _fbKey.currentState.value['grade']; | |
_.setGrade(grade: thisgrade); | |
} | |
}, child: Text('pressme')) | |
]) | |
) | |
); | |
} | |
); | |
} | |
} | |
import 'package:flutter/material.dart'; | |
class Freinds { | |
String id; | |
String firstName; | |
String secondName; | |
String subtitle; | |
AssetImage image; | |
TimeOfDay dateTime; | |
Freinds( | |
{this.id, | |
this.firstName, | |
this.secondName, | |
this.image, | |
this.subtitle, | |
this.dateTime}); | |
} | |
class ChatProvider extends ChangeNotifier { | |
int _grade = 0; | |
get grade => _grade; | |
void setGrade({int grade}) { | |
_grade= grade; | |
notifyListeners(); | |
} | |
List _iteams = [ | |
Freinds( | |
firstName: 'Abdullah', | |
secondName: 'Gaber', | |
image: AssetImage('images/m3.jpg'), | |
subtitle: 'الهاكر اخويا', | |
dateTime: TimeOfDay.now(), | |
), | |
Freinds( | |
firstName: 'Khaled', | |
secondName: 'Fathy', | |
image: AssetImage('images/m2.jpg'), | |
subtitle: 'الهاكر اخويا', | |
dateTime: TimeOfDay.now(), | |
), | |
Freinds( | |
firstName: 'Ahmed', | |
secondName: 'Kassem', | |
image: AssetImage('images/m5.jpg'), | |
subtitle: 'تمام', | |
dateTime: TimeOfDay.now(), | |
), | |
Freinds( | |
firstName: 'Ahmed', | |
secondName: 'Sleem', | |
image: AssetImage('images/m4.jpg'), | |
subtitle: 'الهاكر اخويا', | |
dateTime:TimeOfDay.now(), | |
), | |
Freinds( | |
firstName: 'Abdullah', | |
secondName: 'Gaber', | |
image: AssetImage('images/m3.jpg'), | |
subtitle: 'الهاكر اخويا', | |
dateTime: TimeOfDay.now(), | |
), | |
Freinds( | |
firstName: 'Khaled', | |
secondName: 'Fathy', | |
image: AssetImage('images/m2.jpg'), | |
subtitle: 'الهاكر اخويا', | |
dateTime: TimeOfDay.now(), | |
), | |
Freinds( | |
firstName: 'Ahmed', | |
secondName: 'Kassem', | |
image: AssetImage('images/m5.jpg'), | |
subtitle: 'تمام', | |
dateTime: TimeOfDay.now(), | |
), | |
Freinds( | |
firstName: 'Ahmed', | |
secondName: 'Sleem', | |
image: AssetImage('images/m4.jpg'), | |
subtitle: 'الهاكر اخويا', | |
dateTime: TimeOfDay.now(), | |
), | |
Freinds( | |
firstName: 'Ahmed', | |
secondName: 'Sleem', | |
image: AssetImage('images/m4.jpg'), | |
subtitle: 'الهاكر اخويا', | |
dateTime: TimeOfDay.now(), | |
), | |
]; | |
List<Freinds> get iteams { | |
return [..._iteams]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment