Skip to content

Commit

Permalink
on long press avatar in tombidoscope display image in fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
odrevet committed May 31, 2019
1 parent 4c727dc commit d550a5c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/account.dart
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class AccountPageWidget extends StatelessWidget {
},
fullscreenDialog: true));
}

Widget _buildView(BuildContext context, Account account) {
final url = baseUri + account.avatar;
final image = NetworkImage(url);
Expand Down
21 changes: 20 additions & 1 deletion lib/trombidoscope.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,28 @@ class _TrombidoscopeWidgetState extends State<TrombidoscopeWidget> {
);
}

_openAvatarViewerDialog(context, image){
Navigator.of(context).push(MaterialPageRoute<Null>(
builder: (BuildContext context) {
return Container(
decoration: BoxDecoration(
image: DecorationImage(
image: image,
fit: BoxFit.cover,
),
),
);
},
fullscreenDialog: true));
}

Widget _buildView(
BuildContext context, Map<String, AccountLink> accountLinks) {
var rows = <GestureDetector>[];

accountLinks.forEach((img, accountLink) {
var url = baseUri + img;
final url = baseUri + img;

rows.add(GestureDetector(
onTap: () {
Navigator.push(
Expand All @@ -97,6 +113,9 @@ class _TrombidoscopeWidgetState extends State<TrombidoscopeWidget> {
builder: (context) => AccountPageWidget(
account: fetchAccount(accountLink.id))));
},
onLongPress: () {
_openAvatarViewerDialog(context, NetworkImage(url));
},
child: Container(
child: Text(accountLink.name, style: _font),
decoration: BoxDecoration(
Expand Down

0 comments on commit d550a5c

Please sign in to comment.