import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
home: MyWidget(),
),
);
}
class MyWidget extends StatefulWidget {
const MyWidget({Key? key}) : super(key: key);
State<MyWidget> createState() => _MyWidgetState();
}
class _MyWidgetState extends State<MyWidget> {
bool? isChecked = false;
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: CheckboxListTile(
activeColor: Colors.orange,
checkColor: Colors.yellow,
controlAffinity: ListTileControlAffinity.leading,
tristate: true,
title: const Text('クリックして'),
subtitle: const Text('これはReinのテストです'),
value: isChecked,
onChanged: (value) {
setState(() {
isChecked = value;
});
},
),
),
);
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.