class AddName extends StatefulWidget {
AddName({Key key}) : super(key: key);
@override
_AddNameState createState() => _AddNameState();
final myController = TextEditingController();
final List<Names> addTo = [];
void showDialogForm(
BuildContext context, List<Names> myNames, Groups inGroup) {
bool addOrNot = false;
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
// content: Stack(
// clipBehavior: Clip.none,
// children: <Widget>[
// Positioned(
// right: -40.0,
// top: -40.0,
// child: InkResponse(
// onTap: () {
// Navigator.of(context).pop();
// },
// child: CircleAvatar(
// child: Icon(Icons.close),
// backgroundColor: Colors.blue[900],
// ),
// ),
// ),
content: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Expanded(
flex: 9,
child: Container(
height: 400,
width: 400,
child: ListView.builder(
physics: BouncingScrollPhysics(
parent:
AlwaysScrollableScrollPhysics()), // making it able to scroll
itemCount: myNames.length,
itemBuilder: (context, index) {
Names name = myNames[index];
return Padding(
padding: EdgeInsets.all(20),
child: CheckboxListTile(
value: addOrNot,
title: Center(
child: Text(name.personName ?? "00"),
),
onChanged: (bool value) {
value = addOrNot;
if (!addTo.contains(name)) {
addTo.add(name);
} else if (addTo.contains(name)) {
addTo.remove(name);
}
},
),
);
},
),
),
),
Expanded(
flex: 1,
child: ElevatedButton(
style: ButtonStyle(
shape:
MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
side:
BorderSide(color: Colors.blue[900])))),
child: Text("Add Names To Group"),
onPressed: () {
for (var names in addTo) {
inGroup.addToGroup(names);
}
Navigator.pop(context);
},
),
)
],
),
// ],
//),
);
});
}
}
class _AddNameState extends State<AddName> {
@override
void dispose() {
widget.myController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Container();
}
}