expansion_tile_card 1.0.0+1 expansion_tile_card: ^1.0.0+1 copied to clipboard
An "expansion" on the Flutter SDK's standard ExpansionTile, to create a Google Material Theme inspired raised widget, ExpansionTileCard, instead.
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 Demo',
theme: ThemeData(
primarySwatch: Colors.green,
),
home: MyHomePage(title: 'ExpansionTileCard Demo'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: ListView.builder(itemBuilder: (BuildContext context, int index) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: ExpansionTileCard(
leading: CircleAvatar(child: Text('$index')),
title: Text('This is item #$index'),
subtitle: Text('Tap to see more!'),
children: <Widget>[
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.only(
left: 16.0,
right: 16.0,
bottom: 4.0,
),
child: Text(
"""Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent id nisl quis justo fringilla vehicula. Ut rutrum sapien enim, in egestas libero malesuada a. Donec tincidunt porttitor luctus. Nunc imperdiet laoreet libero id ornare. Quisque viverra est sed arcu varius, suscipit interdum turpis pharetra.""",
style: Theme.of(context)
.textTheme
.bodyText2
.copyWith(fontSize: 16),
),
),
),
ButtonBar(
alignment: MainAxisAlignment.spaceAround,
buttonHeight: 52.0,
buttonMinWidth: 90.0,
children: <Widget>[
FlatButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4.0)),
onPressed: () {},
child: Column(
children: <Widget>[
Icon(Icons.star),
Padding(
padding: const EdgeInsets.symmetric(vertical: 2.0),
),
Text('Save'),
],
),
),
FlatButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4.0)),
onPressed: () {},
child: Column(
children: <Widget>[
Icon(Icons.open_in_browser),
Padding(
padding: const EdgeInsets.symmetric(vertical: 2.0),
),
Text('Open'),
],
),
),
FlatButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4.0)),
onPressed: () {},
child: Column(
children: <Widget>[
Icon(Icons.share),
Padding(
padding: const EdgeInsets.symmetric(vertical: 2.0),
),
Text('Share'),
],
),
),
],
),
],
),
);
}),
);
}
}