parent
95e5da70ed
commit
c7f037de0f
|
@ -117,8 +117,6 @@ analyzer:
|
|||
- "**/*.g.dart"
|
||||
- "**/*.freezed.dart"
|
||||
- "lib/gen/assets.gen.dart"
|
||||
strong-mode:
|
||||
# TODO: remove after migrating to null safety, this is already turned off by default
|
||||
implicit-casts: false
|
||||
# TODO: consider disabling
|
||||
# implicit-dynamic: false
|
||||
# strong-mode:
|
||||
# TODO: consider disabling
|
||||
# implicit-dynamic: false
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:lemmy_api_client/v3.dart';
|
||||
|
@ -123,10 +122,8 @@ class AddAccountPage extends HookWidget {
|
|||
),
|
||||
title: const Text('Add instance'),
|
||||
onTap: () async {
|
||||
final value = await showCupertinoModalPopup<String>(
|
||||
context: context,
|
||||
builder: (context) => const AddInstancePage(),
|
||||
);
|
||||
final value =
|
||||
await Navigator.of(context).push(AddInstancePage.route());
|
||||
Navigator.of(context).pop(value);
|
||||
},
|
||||
),
|
||||
|
@ -178,4 +175,9 @@ class AddAccountPage extends HookWidget {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
static Route<String> route(String instanceHost) => MaterialPageRoute(
|
||||
builder: (context) => AddAccountPage(instanceHost: instanceHost),
|
||||
fullscreenDialog: true,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -132,4 +132,9 @@ class AddInstancePage extends HookWidget {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
static Route<String> route() => MaterialPageRoute(
|
||||
builder: (context) => const AddInstancePage(),
|
||||
fullscreenDialog: true,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
|
@ -33,11 +32,10 @@ class CreatePostFab extends HookWidget {
|
|||
|
||||
return FloatingActionButton(
|
||||
onPressed: loggedInAction((_) async {
|
||||
final postView = await showCupertinoModalPopup<PostView>(
|
||||
context: context,
|
||||
builder: (_) => community == null
|
||||
? const CreatePostPage()
|
||||
: CreatePostPage.toCommunity(community!),
|
||||
final postView = await Navigator.of(context).push(
|
||||
community == null
|
||||
? CreatePostPage.route()
|
||||
: CreatePostPage.toCommunityRoute(community!),
|
||||
);
|
||||
|
||||
if (postView != null) {
|
||||
|
@ -67,7 +65,7 @@ class CreatePostPage extends HookWidget {
|
|||
const CreatePostPage.toCommunity(CommunityView this.community)
|
||||
: _isEdit = false,
|
||||
post = null;
|
||||
const CreatePostPage.edit(this.post)
|
||||
const CreatePostPage.edit(Post this.post)
|
||||
: _isEdit = true,
|
||||
community = null;
|
||||
|
||||
|
@ -352,4 +350,20 @@ class CreatePostPage extends HookWidget {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
static Route<PostView> route() => MaterialPageRoute(
|
||||
builder: (context) => const CreatePostPage(),
|
||||
fullscreenDialog: true,
|
||||
);
|
||||
|
||||
static Route<PostView> toCommunityRoute(CommunityView community) =>
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CreatePostPage.toCommunity(community),
|
||||
fullscreenDialog: true,
|
||||
);
|
||||
|
||||
static Route<PostView> editRoute(Post post) => MaterialPageRoute(
|
||||
builder: (context) => CreatePostPage.edit(post),
|
||||
fullscreenDialog: true,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
|
@ -84,9 +83,8 @@ class FullPostPage extends HookWidget {
|
|||
sharePost() => share(post.post.apId, context: context);
|
||||
|
||||
comment() async {
|
||||
final newComment = await showCupertinoModalPopup<CommentView>(
|
||||
context: context,
|
||||
builder: (_) => WriteComment.toPost(post.post),
|
||||
final newComment = await Navigator.of(context).push(
|
||||
WriteComment.toPostRoute(post.post),
|
||||
);
|
||||
if (newComment != null) {
|
||||
newComments.value = [...newComments.value, newComment];
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import 'dart:math' show max;
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:lemmy_api_client/v3.dart';
|
||||
|
@ -158,10 +157,8 @@ class HomeTab extends HookWidget {
|
|||
: null),
|
||||
),
|
||||
onTap: accStore.isAnonymousFor(instance)
|
||||
? () => showCupertinoModalPopup(
|
||||
context: context,
|
||||
builder: (_) =>
|
||||
AddAccountPage(instanceHost: instance))
|
||||
? () => Navigator.of(context)
|
||||
.push(AddAccountPage.route(instance))
|
||||
: () => pop(_SelectedList(
|
||||
listingType: PostListingType.subscribed,
|
||||
instanceHost: instance,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import 'dart:math' show pi;
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:lemmy_api_client/v3.dart';
|
||||
|
@ -364,12 +363,12 @@ class PrivateMessageTile extends HookWidget {
|
|||
icon: Icons.reply,
|
||||
tooltip: L10n.of(context)!.reply,
|
||||
onPressed: () {
|
||||
showCupertinoModalPopup(
|
||||
context: context,
|
||||
builder: (_) => WriteMessagePage.send(
|
||||
instanceHost: pmv.value.instanceHost,
|
||||
recipient: otherSide,
|
||||
));
|
||||
Navigator.of(context).push(
|
||||
WriteMessagePage.sendRoute(
|
||||
instanceHost: pmv.value.instanceHost,
|
||||
recipient: otherSide,
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
] else ...[
|
||||
|
@ -377,9 +376,8 @@ class PrivateMessageTile extends HookWidget {
|
|||
icon: Icons.edit,
|
||||
tooltip: L10n.of(context)!.edit,
|
||||
onPressed: () async {
|
||||
final val = await showCupertinoModalPopup<PrivateMessageView>(
|
||||
context: context,
|
||||
builder: (_) => WriteMessagePage.edit(pmv.value));
|
||||
final val = await Navigator.of(context)
|
||||
.push(WriteMessagePage.editRoute(pmv.value));
|
||||
if (val != null) pmv.value = val;
|
||||
},
|
||||
),
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:lemmy_api_client/v3.dart';
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
|
@ -327,16 +326,13 @@ class AccountsConfigPage extends HookWidget {
|
|||
SpeedDialChild(
|
||||
child: const Icon(Icons.person_add),
|
||||
label: 'Add account',
|
||||
onTap: () => showCupertinoModalPopup(
|
||||
context: context,
|
||||
builder: (_) =>
|
||||
AddAccountPage(instanceHost: accountsStore.instances.last)),
|
||||
onTap: () => Navigator.of(context)
|
||||
.push(AddAccountPage.route(accountsStore.instances.last)),
|
||||
),
|
||||
SpeedDialChild(
|
||||
child: const Icon(Icons.dns),
|
||||
label: 'Add instance',
|
||||
onTap: () => showCupertinoModalPopup(
|
||||
context: context, builder: (_) => const AddInstancePage()),
|
||||
onTap: () => Navigator.of(context).push(AddInstancePage.route()),
|
||||
),
|
||||
],
|
||||
child: const Icon(Icons.add),
|
||||
|
@ -350,10 +346,8 @@ class AccountsConfigPage extends HookWidget {
|
|||
Padding(
|
||||
padding: const EdgeInsets.only(top: 100),
|
||||
child: TextButton.icon(
|
||||
onPressed: () => showCupertinoModalPopup(
|
||||
context: context,
|
||||
builder: (_) => const AddInstancePage(),
|
||||
),
|
||||
onPressed: () =>
|
||||
Navigator.of(context).push(AddInstancePage.route()),
|
||||
icon: const Icon(Icons.add),
|
||||
label: const Text('Add instance'),
|
||||
),
|
||||
|
@ -393,9 +387,7 @@ class AccountsConfigPage extends HookWidget {
|
|||
leading: const Icon(Icons.add),
|
||||
title: const Text('Add account'),
|
||||
onTap: () {
|
||||
showCupertinoModalPopup(
|
||||
context: context,
|
||||
builder: (_) => AddAccountPage(instanceHost: instance));
|
||||
Navigator.of(context).push(AddAccountPage.route(instance));
|
||||
},
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:lemmy_api_client/v3.dart';
|
||||
|
@ -69,12 +68,14 @@ class SendMessageButton extends HookWidget {
|
|||
|
||||
return IconButton(
|
||||
icon: const Icon(Icons.email),
|
||||
onPressed: loggedInAction((token) => showCupertinoModalPopup(
|
||||
context: context,
|
||||
builder: (_) => WriteMessagePage.send(
|
||||
instanceHost: user.instanceHost,
|
||||
recipient: user,
|
||||
))),
|
||||
onPressed: loggedInAction(
|
||||
(token) => Navigator.of(context).push(
|
||||
WriteMessagePage.sendRoute(
|
||||
instanceHost: user.instanceHost,
|
||||
recipient: user,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,4 +133,22 @@ class WriteMessagePage extends HookWidget {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
static Route<PrivateMessageView> sendRoute({
|
||||
required PersonSafe recipient,
|
||||
required String instanceHost,
|
||||
}) =>
|
||||
MaterialPageRoute(
|
||||
builder: (context) => WriteMessagePage.send(
|
||||
recipient: recipient,
|
||||
instanceHost: instanceHost,
|
||||
),
|
||||
fullscreenDialog: true,
|
||||
);
|
||||
|
||||
static Route<PrivateMessageView> editRoute(PrivateMessageView pmv) =>
|
||||
MaterialPageRoute(
|
||||
builder: (context) => WriteMessagePage.edit(pmv),
|
||||
fullscreenDialog: true,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,13 @@ ThemeData _themeFactory({bool dark = false, bool amoled = false}) {
|
|||
final maybeAmoledColor = amoled ? Colors.black : null;
|
||||
|
||||
return theme.copyWith(
|
||||
pageTransitionsTheme: const PageTransitionsTheme(
|
||||
builders: {
|
||||
TargetPlatform.android: CupertinoPageTransitionsBuilder(),
|
||||
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
|
||||
TargetPlatform.fuchsia: CupertinoPageTransitionsBuilder(),
|
||||
},
|
||||
),
|
||||
scaffoldBackgroundColor: maybeAmoledColor,
|
||||
backgroundColor: maybeAmoledColor,
|
||||
canvasColor: maybeAmoledColor,
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:url_launcher/url_launcher.dart' as ul;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Creates gaps between given widgets
|
||||
extension SpaceWidgets on List<Widget> {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lemmy_api_client/v3.dart';
|
||||
|
||||
|
@ -13,7 +12,7 @@ Future<dynamic> goTo(
|
|||
BuildContext context,
|
||||
Widget Function(BuildContext context) builder,
|
||||
) =>
|
||||
Navigator.of(context).push(CupertinoPageRoute(
|
||||
Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: builder,
|
||||
));
|
||||
|
||||
|
@ -22,7 +21,7 @@ Future<dynamic> goToReplace(
|
|||
BuildContext context,
|
||||
Widget Function(BuildContext context) builder,
|
||||
) =>
|
||||
Navigator.of(context).pushReplacement(CupertinoPageRoute(
|
||||
Navigator.of(context).pushReplacement(MaterialPageRoute(
|
||||
builder: builder,
|
||||
));
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lemmy_api_client/v3.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
|
@ -33,9 +32,8 @@ class CommentActions extends HookWidget {
|
|||
final post = store.comment.post;
|
||||
|
||||
reply() async {
|
||||
final newComment = await showCupertinoModalPopup<CommentView>(
|
||||
context: context,
|
||||
builder: (context) => WriteComment.toComment(
|
||||
final newComment = await Navigator.of(context).push(
|
||||
WriteComment.toCommentRoute(
|
||||
comment: comment,
|
||||
post: post,
|
||||
),
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:lemmy_api_client/v3.dart';
|
||||
|
@ -63,9 +62,8 @@ class _CommentMoreMenuPopup extends HookWidget {
|
|||
}
|
||||
|
||||
handleEdit() async {
|
||||
final editedComment = await showCupertinoModalPopup<CommentView>(
|
||||
context: context,
|
||||
builder: (_) => WriteComment.edit(
|
||||
final editedComment = await Navigator.of(context).push(
|
||||
WriteComment.editRoute(
|
||||
comment: comment,
|
||||
post: post,
|
||||
),
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../pages/media_view.dart';
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
|
@ -103,9 +102,8 @@ class PostWidget extends HookWidget {
|
|||
leading: const Icon(Icons.edit),
|
||||
title: const Text('Edit'),
|
||||
onTap: () async {
|
||||
final postView = await showCupertinoModalPopup<PostView>(
|
||||
context: context,
|
||||
builder: (_) => CreatePostPage.edit(post.post),
|
||||
final postView = await Navigator.of(context).push(
|
||||
CreatePostPage.editRoute(post.post),
|
||||
);
|
||||
|
||||
if (postView != null) {
|
||||
|
|
|
@ -134,4 +134,28 @@ class WriteComment extends HookWidget {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
static Route<CommentView> toPostRoute(Post post) => MaterialPageRoute(
|
||||
builder: (context) => WriteComment.toPost(post),
|
||||
fullscreenDialog: true,
|
||||
);
|
||||
|
||||
static Route<CommentView> toCommentRoute({
|
||||
required Comment comment,
|
||||
required Post post,
|
||||
}) =>
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
WriteComment.toComment(comment: comment, post: post),
|
||||
fullscreenDialog: true,
|
||||
);
|
||||
|
||||
static Route<CommentView> editRoute({
|
||||
required Comment comment,
|
||||
required Post post,
|
||||
}) =>
|
||||
MaterialPageRoute(
|
||||
builder: (context) => WriteComment.edit(comment: comment, post: post),
|
||||
fullscreenDialog: true,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue