import
'package:flutter/material.dart'
;
import
'package:expansion_tile_card/expansion_tile_card.dart'
;
void
main() => runApp(MyApp());
class
MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return
MaterialApp(
title:
'ExpansionTileCard'
,
theme: ThemeData(
primarySwatch: Colors.green,
),
home: MyHomePage(title:
'GeeksForGeeks'
),
);
}
}
class
MyHomePage extends StatefulWidget {
MyHomePage({Key key,
this
.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class
_MyHomePageState extends State<MyHomePage> {
final GlobalKey<ExpansionTileCardState> cardA =
new
GlobalKey();
final GlobalKey<ExpansionTileCardState> cardB =
new
GlobalKey();
@override
Widget build(BuildContext context) {
return
Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: ListView(
children: <Widget>[
Padding(
padding:
const
EdgeInsets.symmetric(horizontal: 12.0),
child: ExpansionTileCard(
key: cardB,
leading: CircleAvatar(child: Text(
'A'
)),
title: Text(
'Tap to Expand!'
),
subtitle: Text(
'It has the GFG Logo.'
),
children: <Widget>[
Divider(
thickness: 1.0,
height: 1.0,
),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding:
const
EdgeInsets.symmetric(
horizontal: 16.0,
vertical: 8.0,
),
child: Image.asset(
'assets/gfg.png'
)
),
),
],
),
),
]
),
);
}
}