You are on page 1of 1

import 'package:flutter/material.

dart';

class DemoCheck extends StatefulWidget {


@override
DemoCheckState createState() => new DemoCheckState();
}

class DemoCheckState extends State<Demo> {


Map<String, bool> values = {
'foo': true,
'bar': false,
};

@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: Text('Demo')),
body: ListView(
children: values.keys.map((String key) {
return new CheckboxListTile(
title: Text(key),
value: values[key],
onChanged: (bool value) {
setState(() {
values[key] = value;
});
},
);
}).toList(),
),
);
}
}

void main() {
runApp( MaterialApp(home: DemoCheck()));
}

You might also like