|
|
|
|
@ -1,13 +1,11 @@
|
|
|
|
|
/*
|
|
|
|
|
*@author: Amjad Amireh
|
|
|
|
|
*@Date:27/5/2020
|
|
|
|
|
*@param:
|
|
|
|
|
*@return:Create Expand list with snakebar notification
|
|
|
|
|
*@param:listItems , headerTitle
|
|
|
|
|
*@return:ListItem Expand
|
|
|
|
|
|
|
|
|
|
*@desc:
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
class ListItem extends StatefulWidget{
|
|
|
|
|
@ -28,7 +26,6 @@ class ListItemState extends State<ListItem>
|
|
|
|
|
bool isExpand=false;
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
// TODO: implement initState
|
|
|
|
|
super.initState();
|
|
|
|
|
isExpand=false;
|
|
|
|
|
}
|
|
|
|
|
@ -40,16 +37,21 @@ class ListItemState extends State<ListItem>
|
|
|
|
|
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)
|
|
|
|
|
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),)),
|
|
|
|
|
trailing: (isExpand==true)?Icon(Icons.keyboard_arrow_up,size: 32,color: Colors.black,):Icon(Icons.keyboard_arrow_down,size: 32,color: Colors.black),
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
@ -61,18 +63,20 @@ class ListItemState extends State<ListItem>
|
|
|
|
|
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 )));
|
|
|
|
|
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.grey,
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(4)),
|
|
|
|
|
border: Border.all(color: Colors.grey)
|
|
|
|
|
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.white),),
|
|
|
|
|
child: Text(item,style: TextStyle(color: Colors.black),),
|
|
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|