Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Widget build(BuildContext context) {
- Size size = MediaQuery.of(context).size;
- return Scaffold(
- backgroundColor: Colors.green[200],
- appBar: AppBar(
- backgroundColor: Colors.white,
- actions: [
- Container(
- width: size.width,
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: Row(
- mainAxisSize: MainAxisSize.max,
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Align(
- alignment: Alignment.centerLeft,
- child: IconButton(
- icon: Icon(Icons.sort, color: Colors.black),
- onPressed: () {},
- ),
- ),
- IconButton(
- icon: Icon(Icons.add_circle, color: Colors.black),
- onPressed: () async {
- setState(() {
- _pickingType = FileType.audio;
- _openFileExplorer();
- if (_pickingType != FileType.custom) {
- _controller.text = _extension = '';
- }
- });
- },
- ),
- ],
- ),
- ),
- ),
- ],
- ),
- body: Padding(
- padding: const EdgeInsets.all(15),
- child: Column(
- mainAxisSize: MainAxisSize.max,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- 'Library',
- style: TextStyle(
- color: Colors.black,
- fontWeight: FontWeight.bold,
- fontSize: 37),
- ),
- SizedBox(
- height: size.height * 0.020,
- ),
- Builder(
- builder: (BuildContext context) => _loadingPath
- ? Padding(
- padding: const EdgeInsets.only(bottom: 10.0),
- child: const CircularProgressIndicator(),
- )
- : _directoryPath != null
- ? ListTile(
- title: Text('Directory path'),
- subtitle: Text(_directoryPath),
- )
- : _paths != null
- ? Container(
- padding: const EdgeInsets.only(bottom: 30.0),
- height: MediaQuery.of(context).size.height * 0.50,
- child: ListView.separated(
- itemCount: _paths.length,
- itemBuilder: (BuildContext context, int index) {
- final bool isMultiPath =
- _paths != null && _paths.isNotEmpty;
- final String name = (isMultiPath
- ? _paths
- .map((e) => e.name)
- .toList()[index]
- : _fileName ?? '...');
- final path = _paths
- .map((e) => e.path)
- .toList()[index]
- .toString();
- return Container(
- width: double.infinity,
- child: BookInfoTile(
- bookCoverImageURL:
- 'assets/images/educated-book-cover.jpg',
- bookTitle: name,
- authorName: 'Tara Westover',
- completedPortionOfBook: 25,
- ),
- );
- },
- separatorBuilder:
- (BuildContext context, int index) =>
- const Divider(),
- ),
- )
- : const SizedBox(),
- ),
- ],
- ),
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment