Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 1.22 KB | None | 0 0
  1. class _PractState extends State<EnPract> {
  2.   Widget build(BuildContext context) {
  3.     return Scaffold(
  4.       appBar: AppBar(
  5.         backgroundColor: Colors.blueGrey,
  6.         title: Text('Practice Tests'),
  7.       ),
  8.       body: Stack(
  9.         children: <Widget>[
  10.           Container(
  11.               width: 600,
  12.               height: 850,
  13.               child: Image.asset("assets/pencilbg.png",
  14.                   fit: BoxFit.fill, alignment: Alignment.center)),
  15.           ListView.builder(
  16.             itemBuilder: (BuildContext context, int index) =>
  17.                 EntryItem(data[index]),
  18.             itemCount: data.length,
  19.           )
  20.         ],
  21.       ),
  22.     );
  23.   }
  24. }
  25.  
  26. class EntryItem extends StatelessWidget {
  27.   const EntryItem(this.entry);
  28.  
  29.   final Entry entry;
  30.  
  31.   Widget _buildTiles(Entry root) {
  32.     if (root.children.isEmpty) return ListTile(title: Text(root.title), onTap: ,);
  33.     return Card(
  34.         elevation: 1,
  35.         child: ExpansionTile(
  36.           key: PageStorageKey<Entry>(root),
  37.           title: Text(root.title),
  38.           children: root.children.map<Widget>(_buildTiles).toList(),
  39.         ));
  40.   }
  41.  
  42.   @override
  43.   Widget build(BuildContext context) {
  44.     return _buildTiles(entry);
  45.   }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement