Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
809 additions
and
661 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_mobx/flutter_mobx.dart'; | ||
import 'package:flutter_modular/flutter_modular.dart'; | ||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; | ||
|
||
import '../../../shared/constants.dart'; | ||
import '../../../shared/widgets/empty_indicator.dart'; | ||
import '../bookmark_controller.dart'; | ||
import 'bookmark_tile.dart'; | ||
|
||
class BookmarkListBody extends StatelessWidget { | ||
final BookmarkController controller = Modular.get(); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Observer( | ||
builder: (context) { | ||
return controller.bookmarks.isEmpty | ||
? EmptyIndicator( | ||
icon: MdiIcons.trayAlert, | ||
message: 'No bookmarks saved', | ||
) | ||
: ListView.builder( | ||
itemCount: controller.bookmarks.length, | ||
padding: const EdgeInsets.symmetric(horizontal: tileHorizontalPadding, vertical: tileVerticalPadding), | ||
itemBuilder: (context, index) { | ||
var bookmark = controller.bookmarks[index]; | ||
return BookmarkTile( | ||
bookmark: bookmark, | ||
index: index, | ||
onTap: () { | ||
Modular.to.pushNamed('/item/${bookmark.id}'); | ||
}, | ||
); | ||
}, | ||
); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_modular/flutter_modular.dart'; | ||
import 'package:flutter_slidable/flutter_slidable.dart'; | ||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; | ||
|
||
import '../../../shared/constants.dart'; | ||
import '../../../shared/models/feed_item.dart'; | ||
import '../../../shared/util/url.dart'; | ||
import '../../../shared/widgets/tile.dart'; | ||
import '../bookmark_controller.dart'; | ||
|
||
class BookmarkTile extends StatelessWidget { | ||
final int index; | ||
final FeedItem bookmark; | ||
final GestureTapCallback onTap; | ||
final BookmarkController controller = Modular.get(); | ||
|
||
BookmarkTile({Key key, this.index, this.bookmark, this.onTap}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Slidable( | ||
key: Key(bookmark.id.toString()), | ||
controller: controller.slidableController, | ||
actionExtentRatio: actionExtentRatio, | ||
actionPane: SlidableDrawerActionPane(), | ||
child: Tile( | ||
title: Text(bookmark.title), | ||
type: bookmark.type, | ||
user: bookmark.user, | ||
domain: bookmark.domain, | ||
time: bookmark.time, | ||
onTap: onTap, | ||
), | ||
secondaryActions: <Widget>[ | ||
IconSlideAction( | ||
caption: 'Delete', | ||
color: Colors.blueGrey, | ||
icon: MdiIcons.bookmarkRemove, | ||
onTap: () { | ||
Scaffold.of(context).showSnackBar( | ||
SnackBar( | ||
content: Text('Bookmark deleted'), | ||
action: SnackBarAction( | ||
label: 'Undo', | ||
onPressed: () { | ||
controller.undoDelete(index, bookmark); | ||
}, | ||
), | ||
), | ||
); | ||
|
||
controller.deleteBookmark(bookmark); | ||
}, | ||
), | ||
IconSlideAction( | ||
caption: 'Share', | ||
color: Colors.indigo, | ||
icon: MdiIcons.shareVariant, | ||
onTap: () { | ||
UrlUtil().share(title: bookmark.title, url: bookmark.url); | ||
}, | ||
), | ||
], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.