Enable sort children last

This commit is contained in:
shilangyu 2021-01-03 17:13:25 +00:00
parent ca47f44e2c
commit c465b09f56
12 changed files with 59 additions and 59 deletions

View File

@ -48,7 +48,7 @@ linter:
avoid_redundant_argument_values: true avoid_redundant_argument_values: true
avoid_escaping_inner_quotes: true avoid_escaping_inner_quotes: true
# always_declare_return_types: true # always_declare_return_types: true
# sort_child_properties_last: true sort_child_properties_last: true
# prefer_const_constructors: true # prefer_const_constructors: true
# prefer_const_declarations: true # prefer_const_declarations: true
# prefer_const_literals_to_create_immutables: true # prefer_const_literals_to_create_immutables: true

View File

@ -128,6 +128,9 @@ class AddAccountPage extends HookWidget {
), ),
FlatButton( FlatButton(
onPressed: selectInstance, onPressed: selectInstance,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@ -135,9 +138,6 @@ class AddAccountPage extends HookWidget {
Icon(Icons.arrow_drop_down), Icon(Icons.arrow_drop_down),
], ],
), ),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
), ),
// TODO: add support for password managers // TODO: add support for password managers
TextField( TextField(
@ -173,6 +173,12 @@ class AddAccountPage extends HookWidget {
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
), ),
onPressed: usernameController.text.isEmpty ||
passwordController.text.isEmpty
? null
: loading.pending
? () {}
: handleOnAdd,
child: !loading.loading child: !loading.loading
? Text('Sign in') ? Text('Sign in')
: SizedBox( : SizedBox(
@ -183,21 +189,15 @@ class AddAccountPage extends HookWidget {
AlwaysStoppedAnimation<Color>(theme.canvasColor), AlwaysStoppedAnimation<Color>(theme.canvasColor),
), ),
), ),
onPressed: usernameController.text.isEmpty ||
passwordController.text.isEmpty
? null
: loading.pending
? () {}
: handleOnAdd,
), ),
FlatButton( FlatButton(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
), ),
child: Text('Register'),
onPressed: () { onPressed: () {
ul.launch('https://${selectedInstance.value}/login'); ul.launch('https://${selectedInstance.value}/login');
}, },
child: Text('Register'),
), ),
], ],
), ),

View File

@ -79,11 +79,11 @@ class AddInstancePage extends HookWidget {
SizedBox( SizedBox(
height: 150, height: 150,
child: FullscreenableImage( child: FullscreenableImage(
url: icon.value,
child: CachedNetworkImage( child: CachedNetworkImage(
imageUrl: icon.value, imageUrl: icon.value,
errorWidget: (_, __, ___) => SizedBox.shrink(), errorWidget: (_, __, ___) => SizedBox.shrink(),
), ),
url: icon.value,
)) ))
else if (isSite.value == false) else if (isSite.value == false)
SizedBox( SizedBox(
@ -127,6 +127,7 @@ class AddInstancePage extends HookWidget {
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
), ),
color: theme.accentColor, color: theme.accentColor,
onPressed: isSite.value == true ? handleOnAdd : null,
child: !debounce.loading child: !debounce.loading
? Text('Add') ? Text('Add')
: SizedBox( : SizedBox(
@ -137,7 +138,6 @@ class AddInstancePage extends HookWidget {
AlwaysStoppedAnimation<Color>(theme.canvasColor), AlwaysStoppedAnimation<Color>(theme.canvasColor),
), ),
), ),
onPressed: isSite.value == true ? handleOnAdd : null,
), ),
), ),
), ),

View File

@ -384,7 +384,7 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
Widget build( Widget build(
BuildContext context, double shrinkOffset, bool overlapsContent) { BuildContext context, double shrinkOffset, bool overlapsContent) {
final theme = Theme.of(context); final theme = Theme.of(context);
return Container(child: _tabBar, color: theme.cardColor); return Container(color: theme.cardColor, child: _tabBar);
} }
@override @override
@ -453,8 +453,8 @@ class _AboutTab extends StatelessWidget {
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
), ),
child: Text(community.categoryName),
onPressed: goToCategories, onPressed: goToCategories,
child: Text(community.categoryName),
), ),
), ),
_Divider(), _Divider(),
@ -464,8 +464,8 @@ class _AboutTab extends StatelessWidget {
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
), ),
child: Text('Modlog'),
onPressed: goToModlog, onPressed: goToModlog,
child: Text('Modlog'),
), ),
), ),
_Divider(), _Divider(),
@ -562,14 +562,14 @@ class _FollowButton extends HookWidget {
child: delayed.loading child: delayed.loading
? RaisedButton( ? RaisedButton(
onPressed: null, onPressed: null,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
child: SizedBox( child: SizedBox(
height: 15, height: 15,
width: 15, width: 15,
child: CircularProgressIndicator(), child: CircularProgressIndicator(),
), ),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
) )
: RaisedButton.icon( : RaisedButton.icon(
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 20), padding: EdgeInsets.symmetric(vertical: 5, horizontal: 20),

View File

@ -23,9 +23,9 @@ class CreatePostFab extends HookWidget {
final loggedInAction = useLoggedInAction(null, any: true); final loggedInAction = useLoggedInAction(null, any: true);
return FloatingActionButton( return FloatingActionButton(
child: Icon(Icons.add),
onPressed: loggedInAction((_) => showCupertinoModalPopup( onPressed: loggedInAction((_) => showCupertinoModalPopup(
context: context, builder: (_) => CreatePost())), context: context, builder: (_) => CreatePost())),
child: Icon(Icons.add),
); );
} }
} }

View File

@ -110,8 +110,8 @@ class FullPostPage extends HookWidget {
) )
else else
Container( Container(
child: Center(child: CircularProgressIndicator()),
padding: EdgeInsets.only(top: 40), padding: EdgeInsets.only(top: 40),
child: Center(child: CircularProgressIndicator()),
), ),
], ],
)); ));

View File

@ -199,7 +199,7 @@ class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
Widget build( Widget build(
BuildContext context, double shrinkOffset, bool overlapsContent) { BuildContext context, double shrinkOffset, bool overlapsContent) {
final theme = Theme.of(context); final theme = Theme.of(context);
return Container(child: _tabBar, color: theme.cardColor); return Container(color: theme.cardColor, child: _tabBar);
} }
@override @override

View File

@ -62,22 +62,6 @@ class UserProfileTab extends HookWidget {
shadowColor: Colors.transparent, shadowColor: Colors.transparent,
centerTitle: true, centerTitle: true,
title: FlatButton( title: FlatButton(
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
// TODO: fix overflow issues
'@${accountsStore.defaultUsername}',
style: theme.primaryTextTheme.headline6,
overflow: TextOverflow.fade,
),
Icon(
Icons.expand_more,
color: theme.primaryIconTheme.color,
),
],
),
onPressed: () { onPressed: () {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
@ -114,6 +98,22 @@ class UserProfileTab extends HookWidget {
}, },
); );
}, },
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
// TODO: fix overflow issues
'@${accountsStore.defaultUsername}',
style: theme.primaryTextTheme.headline6,
overflow: TextOverflow.fade,
),
Icon(
Icons.expand_more,
color: theme.primaryIconTheme.color,
),
],
),
), ),
actions: actions, actions: actions,
), ),

View File

@ -106,12 +106,12 @@ class AccountsConfigPage extends HookWidget {
content: Text('Are you sure you want to remove $instanceHost?'), content: Text('Are you sure you want to remove $instanceHost?'),
actions: [ actions: [
FlatButton( FlatButton(
child: Text('no'),
onPressed: () => Navigator.of(context).pop(false), onPressed: () => Navigator.of(context).pop(false),
child: Text('no'),
), ),
FlatButton( FlatButton(
child: Text('yes'),
onPressed: () => Navigator.of(context).pop(true), onPressed: () => Navigator.of(context).pop(true),
child: Text('yes'),
), ),
], ],
), ),
@ -130,12 +130,12 @@ class AccountsConfigPage extends HookWidget {
'Are you sure you want to remove $username@$instanceHost?'), 'Are you sure you want to remove $username@$instanceHost?'),
actions: [ actions: [
FlatButton( FlatButton(
child: Text('no'),
onPressed: () => Navigator.of(context).pop(false), onPressed: () => Navigator.of(context).pop(false),
child: Text('no'),
), ),
FlatButton( FlatButton(
child: Text('yes'),
onPressed: () => Navigator.of(context).pop(true), onPressed: () => Navigator.of(context).pop(true),
child: Text('yes'),
), ),
], ],
), ),
@ -159,7 +159,6 @@ class AccountsConfigPage extends HookWidget {
animatedIcon: AnimatedIcons.menu_close, // TODO: change to + => x animatedIcon: AnimatedIcons.menu_close, // TODO: change to + => x
curve: Curves.bounceIn, curve: Curves.bounceIn,
tooltip: 'Add account or instance', tooltip: 'Add account or instance',
child: Icon(Icons.add),
overlayColor: theme.canvasColor, overlayColor: theme.canvasColor,
children: [ children: [
SpeedDialChild( SpeedDialChild(
@ -179,6 +178,7 @@ class AccountsConfigPage extends HookWidget {
context: context, builder: (_) => AddInstancePage()), context: context, builder: (_) => AddInstancePage()),
), ),
], ],
child: Icon(Icons.add),
), ),
body: ListView( body: ListView(
children: [ children: [
@ -278,9 +278,9 @@ class _SectionHeading extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context); final theme = Theme.of(context);
return Padding( return Padding(
padding: EdgeInsets.only(left: 20),
child: Text(text.toUpperCase(), child: Text(text.toUpperCase(),
style: theme.textTheme.subtitle2.copyWith(color: theme.accentColor)), style: theme.textTheme.subtitle2.copyWith(color: theme.accentColor)),
padding: EdgeInsets.only(left: 20),
); );
} }
} }

View File

@ -54,14 +54,14 @@ class AboutTile extends HookWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
FlatButton( FlatButton(
child: Text('Patreon'),
onPressed: () => onPressed: () =>
openInBrowser('https://patreon.com/lemmur'), openInBrowser('https://patreon.com/lemmur'),
child: Text('Patreon'),
), ),
FlatButton( FlatButton(
child: Text('Buy Me a Coffee'),
onPressed: () => onPressed: () =>
openInBrowser('https://buymeacoff.ee/lemmur'), openInBrowser('https://buymeacoff.ee/lemmur'),
child: Text('Buy Me a Coffee'),
), ),
], ],
), ),

View File

@ -302,6 +302,15 @@ class Comment extends HookWidget {
child: Column( child: Column(
children: [ children: [
Container( Container(
padding: EdgeInsets.all(10),
margin: EdgeInsets.only(left: indent > 1 ? (indent - 1) * 5.0 : 0),
decoration: BoxDecoration(
border: Border(
left: indent > 0
? BorderSide(
color: colors[indent % colors.length], width: 5)
: BorderSide.none,
top: BorderSide(width: 0.2))),
child: Column( child: Column(
children: [ children: [
Row(children: [ Row(children: [
@ -329,12 +338,12 @@ class Comment extends HookWidget {
), ),
), ),
InkWell( InkWell(
onTap: () => goToUser.byId(
context, comment.instanceHost, comment.creatorId),
child: Text(username, child: Text(username,
style: TextStyle( style: TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context).accentColor,
)), )),
onTap: () => goToUser.byId(
context, comment.instanceHost, comment.creatorId),
), ),
if (isOP) _CommentTag('OP', Theme.of(context).accentColor), if (isOP) _CommentTag('OP', Theme.of(context).accentColor),
if (comment.banned) _CommentTag('BANNED', Colors.red), if (comment.banned) _CommentTag('BANNED', Colors.red),
@ -369,15 +378,6 @@ class Comment extends HookWidget {
actions, actions,
], ],
), ),
padding: EdgeInsets.all(10),
margin: EdgeInsets.only(left: indent > 1 ? (indent - 1) * 5.0 : 0),
decoration: BoxDecoration(
border: Border(
left: indent > 0
? BorderSide(
color: colors[indent % colors.length], width: 5)
: BorderSide.none,
top: BorderSide(width: 0.2))),
), ),
if (!collapsed.value) if (!collapsed.value)
for (final c in newReplies.value.followedBy(commentTree.children)) for (final c in newReplies.value.followedBy(commentTree.children))

View File

@ -151,6 +151,7 @@ class Post extends HookWidget {
], ],
), ),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row(children: [ Row(children: [
RichText( RichText(
@ -219,7 +220,6 @@ class Post extends HookWidget {
)) ))
]), ]),
], ],
crossAxisAlignment: CrossAxisAlignment.start,
), ),
Spacer(), Spacer(),
if (!fullPost) if (!fullPost)
@ -444,7 +444,7 @@ class _Voting extends HookWidget {
), ),
)), )),
if (loading.loading) if (loading.loading)
SizedBox(child: CircularProgressIndicator(), width: 20, height: 20) SizedBox(width: 20, height: 20, child: CircularProgressIndicator())
else else
Text(NumberFormat.compact() Text(NumberFormat.compact()
.format(post.score + (wasVoted ? 0 : myVote.value.value))), .format(post.score + (wasVoted ? 0 : myVote.value.value))),