import 'package:flutter/material.dart';
main() => runApp(DBJApp());
class DBJApp extends StatelessWidget {
const DBJApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
title: Text('打扮家'),
),
body: DBJBodyContent(),
),
);
}
}
class DBJBodyContent extends StatefulWidget {
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return DBJBodyContentState();
}
}
class DBJBodyContentState extends State<DBJBodyContent> {
var flag = false;
@override
Widget build(BuildContext context) {
// TODO: implement build
return Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Checkbox(
value: flag,
onChanged: (state) {
setState(() {
flag = state ?? false;
print('点击我了');
});
}),
Text(
'同意协议',
style: TextStyle(fontSize: 15, color: Colors.red),
)
],
),
);
}
}
截屏2021-09-01 下午3.55.47.png
网友评论