pparth602

Untitled

Oct 12th, 2020
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 4.40 KB | None | 0 0
  1. Widget build(BuildContext context) {
  2.     Size size = MediaQuery.of(context).size;
  3.     return Scaffold(
  4.       backgroundColor: Colors.green[200],
  5.       appBar: AppBar(
  6.         backgroundColor: Colors.white,
  7.         actions: [
  8.           Container(
  9.             width: size.width,
  10.             child: Padding(
  11.               padding: const EdgeInsets.all(8.0),
  12.               child: Row(
  13.                 mainAxisSize: MainAxisSize.max,
  14.                 mainAxisAlignment: MainAxisAlignment.spaceBetween,
  15.                 children: [
  16.                   Align(
  17.                     alignment: Alignment.centerLeft,
  18.                     child: IconButton(
  19.                       icon: Icon(Icons.sort, color: Colors.black),
  20.                       onPressed: () {},
  21.                     ),
  22.                   ),
  23.                   IconButton(
  24.                     icon: Icon(Icons.add_circle, color: Colors.black),
  25.                     onPressed: () async {
  26.                       setState(() {
  27.                         _pickingType = FileType.audio;
  28.                         _openFileExplorer();
  29.                         if (_pickingType != FileType.custom) {
  30.                           _controller.text = _extension = '';
  31.                         }
  32.                       });
  33.                     },
  34.                   ),
  35.                 ],
  36.               ),
  37.             ),
  38.           ),
  39.         ],
  40.       ),
  41.       body: Padding(
  42.         padding: const EdgeInsets.all(15),
  43.         child: Column(
  44.           mainAxisSize: MainAxisSize.max,
  45.           crossAxisAlignment: CrossAxisAlignment.start,
  46.           children: [
  47.             Text(
  48.               'Library',
  49.               style: TextStyle(
  50.                   color: Colors.black,
  51.                   fontWeight: FontWeight.bold,
  52.                   fontSize: 37),
  53.             ),
  54.             SizedBox(
  55.               height: size.height * 0.020,
  56.             ),
  57.             Builder(
  58.               builder: (BuildContext context) => _loadingPath
  59.                   ? Padding(
  60.                       padding: const EdgeInsets.only(bottom: 10.0),
  61.                       child: const CircularProgressIndicator(),
  62.                     )
  63.                   : _directoryPath != null
  64.                       ? ListTile(
  65.                           title: Text('Directory path'),
  66.                           subtitle: Text(_directoryPath),
  67.                         )
  68.                       : _paths != null
  69.                           ? Container(
  70.                               padding: const EdgeInsets.only(bottom: 30.0),
  71.                               height: MediaQuery.of(context).size.height * 0.50,
  72.                               child: ListView.separated(
  73.                                 itemCount: _paths.length,
  74.                                 itemBuilder: (BuildContext context, int index) {
  75.                                   final bool isMultiPath =
  76.                                       _paths != null && _paths.isNotEmpty;
  77.                                   final String name = (isMultiPath
  78.                                       ? _paths
  79.                                           .map((e) => e.name)
  80.                                           .toList()[index]
  81.                                       : _fileName ?? '...');
  82.                                   final path = _paths
  83.                                       .map((e) => e.path)
  84.                                       .toList()[index]
  85.                                       .toString();
  86.  
  87.                                   return Container(
  88.                                     width: double.infinity,
  89.                                     child: BookInfoTile(
  90.                                       bookCoverImageURL:
  91.                                           'assets/images/educated-book-cover.jpg',
  92.                                       bookTitle: name,
  93.                                       authorName: 'Tara Westover',
  94.                                       completedPortionOfBook: 25,
  95.                                     ),
  96.                                   );
  97.                                 },
  98.                                 separatorBuilder:
  99.                                     (BuildContext context, int index) =>
  100.                                         const Divider(),
  101.                               ),
  102.                             )
  103.                           : const SizedBox(),
  104.             ),
  105.           ],
  106.         ),
  107.       ),
  108.     );
  109.   }
  110. }
  111.  
Advertisement
Add Comment
Please, Sign In to add comment