Skip to content

Instantly share code, notes, and snippets.

@susatthi
Created January 22, 2023 02:22
Show Gist options
  • Save susatthi/65378b4ab60f0d1c28b051045529557a to your computer and use it in GitHub Desktop.
Save susatthi/65378b4ab60f0d1c28b051045529557a to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
primarySwatch: Colors.blue,
),
home: const MyWidget(),
);
}
}
class MyWidget extends StatefulWidget {
const MyWidget({super.key});
@override
MyWidgetState createState() => MyWidgetState();
}
class MyWidgetState extends State<MyWidget> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: GestureDetector(
onTap: () async {
setState(() {});
},
child: const Icon(Icons.change_circle))),
body: Column(
children: [
ExpansionTile(
// ビルドする度にkey値を変えることで、ExpansionTileの再生成を促す
key: GlobalKey(),
title: const Text('Expansion Tile'),
leading: const Icon(Icons.ac_unit),
initiallyExpanded: false,
children: const [
ListTile(
title: Text('ListTile'),
leading: Icon(Icons.wb_sunny),
),
],
)
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment