amjad modified to expand list
parent
bb606e6a1d
commit
9aae4b8650
@ -0,0 +1,20 @@
|
|||||||
|
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;
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
child: Text("Refferrd Patiant"),//child,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
*@author: Amjad Amireh
|
||||||
|
*@Date:27/5/2020
|
||||||
|
*@param:
|
||||||
|
*@return:Create Expand list with snakebar notification
|
||||||
|
|
||||||
|
*@desc:
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class ListItem extends StatefulWidget{
|
||||||
|
|
||||||
|
List<String>listItems;
|
||||||
|
String headerTitle;
|
||||||
|
|
||||||
|
ListItem(this.headerTitle,this.listItems);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<StatefulWidget>createState()
|
||||||
|
{
|
||||||
|
return ListItemState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class ListItemState extends State<ListItem>
|
||||||
|
{
|
||||||
|
bool isExpand=false;
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
// TODO: implement initState
|
||||||
|
super.initState();
|
||||||
|
isExpand=false;
|
||||||
|
}
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
List<String>listItem=this.widget.listItems;
|
||||||
|
return Padding(
|
||||||
|
padding: (isExpand==true)?const EdgeInsets.all(8.0):const EdgeInsets.all(12.0),
|
||||||
|
child: Container(
|
||||||
|
decoration:BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: (isExpand!=true)?BorderRadius.all(Radius.circular(8)):BorderRadius.all(Radius.circular(22)),
|
||||||
|
border: Border.all(color: Colors.white)
|
||||||
|
),
|
||||||
|
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),)),
|
||||||
|
trailing: (isExpand==true)?Icon(Icons.keyboard_arrow_up,size: 32,color: Colors.black,):Icon(Icons.keyboard_arrow_down,size: 32,color: Colors.black),
|
||||||
|
onExpansionChanged: (value){
|
||||||
|
setState(() {
|
||||||
|
isExpand=value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
for(final item in listItem)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: (){
|
||||||
|
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.grey,
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(4)),
|
||||||
|
border: Border.all(color: Colors.grey)
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(item,style: TextStyle(color: Colors.white),),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue