Merge branch 'master' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into mohammad
commit
9ce7d3267b
@ -0,0 +1,102 @@
|
||||
/*
|
||||
*@author: Amjad Amireh Modified Referred Patients
|
||||
*@Date:27/5/2020
|
||||
|
||||
|
||||
*@desc:
|
||||
*/
|
||||
|
||||
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/expandable_item_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class PatientReferredScreen extends StatefulWidget {
|
||||
PatientReferredScreen({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_PatientReferredScreenState createState() => _PatientReferredScreenState();
|
||||
}
|
||||
|
||||
class _PatientReferredScreenState extends State<PatientReferredScreen> {
|
||||
|
||||
String patientType;
|
||||
String patientTypetitle;
|
||||
|
||||
List<Map<dynamic,dynamic>>list_product;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
list_product=new List();
|
||||
for(var k=1;k<=5;k++)
|
||||
{
|
||||
Map map=Map();
|
||||
map.putIfAbsent(getName(k), ()=>getContent());
|
||||
list_product.add(map);
|
||||
|
||||
}
|
||||
list_product.map((s){
|
||||
|
||||
}).map((list)=>list).toList();}
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
List<String>list=List();
|
||||
|
||||
return AppScaffold(
|
||||
appBarTitle: "My Referred Patients",//patientTypetitle,
|
||||
body: Center(
|
||||
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
for(final map in list_product)
|
||||
for(final keys in map.keys)
|
||||
ExpandableItem(keys,map[keys].toList())
|
||||
,
|
||||
],
|
||||
)
|
||||
),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
String getName(int month)
|
||||
{
|
||||
switch(month)
|
||||
{
|
||||
case 1:
|
||||
return "Mahmoud Shrouf";
|
||||
case 2:
|
||||
return "Mahmoud Shrouf";
|
||||
case 3:
|
||||
return "Mahmoud Shrouf";
|
||||
case 4:
|
||||
return "Mahmoud Shrouf";
|
||||
case 5:
|
||||
return "Mahmoud Shrouf";
|
||||
case 6:
|
||||
return "Mahmoud Shrouf";
|
||||
case 7:
|
||||
return "Mahmoud Shrouf";
|
||||
case 8:
|
||||
return "Mahmoud Shrouf";
|
||||
case 9:
|
||||
return "Mahmoud Shrouf";
|
||||
case 10:
|
||||
return "Mahmoud Shrouf";
|
||||
case 11:
|
||||
return "Mahmoud Shrouf";
|
||||
case 12:
|
||||
return "Mahmoud Shrouf";
|
||||
}
|
||||
}
|
||||
|
||||
List<dynamic> getContent()
|
||||
{
|
||||
|
||||
return ["1","2","3","4","5","6"].toList();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
/*
|
||||
*@author: Amjad Amireh
|
||||
*@Date:27/5/2020
|
||||
*@param:listItems , headerTitle
|
||||
*@return:ListItem Expand
|
||||
|
||||
*@desc:
|
||||
*/
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ExpandableItem extends StatefulWidget{
|
||||
|
||||
final List<String>listItems;
|
||||
final String headerTitle;
|
||||
|
||||
ExpandableItem(this.headerTitle,this.listItems);
|
||||
|
||||
@override
|
||||
_ExpandableItemState createState() => _ExpandableItemState();
|
||||
|
||||
}
|
||||
class _ExpandableItemState extends State<ExpandableItem>
|
||||
{
|
||||
bool isExpand=false;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
isExpand=false;
|
||||
}
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<String>listItem=this.widget.listItems;
|
||||
return Container(
|
||||
child: Padding(
|
||||
padding: (isExpand==true)?const EdgeInsets.all(6.0):const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
decoration:BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: (isExpand!=true)?BorderRadius.all(Radius.circular(50)):BorderRadius.all(Radius.circular(25)),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
),
|
||||
child: ExpansionTile(
|
||||
key: PageStorageKey<String>(this.widget.headerTitle),
|
||||
title: Container(
|
||||
width: double.infinity,
|
||||
|
||||
child: Text(this.widget.headerTitle,style: TextStyle(fontSize: (isExpand!=true)?18:22,color: Colors.black,fontWeight: FontWeight.bold),)),
|
||||
|
||||
trailing: (isExpand==true)?Icon(Icons.keyboard_arrow_up,color: Colors.black,):Icon(Icons.keyboard_arrow_down,color: Colors.black),
|
||||
onExpansionChanged: (value){
|
||||
setState(() {
|
||||
isExpand=value;
|
||||
});
|
||||
},
|
||||
children: [
|
||||
for(final item in listItem)
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: InkWell(
|
||||
onTap: (){
|
||||
print(Text("Selected Item $item "+this.widget.headerTitle ));
|
||||
//========Stop Snak bar=========== Scaffold.of(context).showSnackBar(SnackBar(backgroundColor: Colors.black,duration:Duration(microseconds: 500),content: Text("Selected Item $item "+this.widget.headerTitle )));
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration:BoxDecoration(
|
||||
color: Colors.white,
|
||||
|
||||
border: Border(top: BorderSide(color: Theme.of(context).dividerColor))
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(item,style: TextStyle(color: Colors.black),),
|
||||
|
||||
)),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
],
|
||||
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue