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_escaping_inner_quotes: true
# always_declare_return_types: true
# sort_child_properties_last: true
sort_child_properties_last: true
# prefer_const_constructors: true
# prefer_const_declarations: true
# prefer_const_literals_to_create_immutables: true

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -62,22 +62,6 @@ class UserProfileTab extends HookWidget {
shadowColor: Colors.transparent,
centerTitle: true,
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: () {
showModalBottomSheet(
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,
),

View File

@ -106,12 +106,12 @@ class AccountsConfigPage extends HookWidget {
content: Text('Are you sure you want to remove $instanceHost?'),
actions: [
FlatButton(
child: Text('no'),
onPressed: () => Navigator.of(context).pop(false),
child: Text('no'),
),
FlatButton(
child: Text('yes'),
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?'),
actions: [
FlatButton(
child: Text('no'),
onPressed: () => Navigator.of(context).pop(false),
child: Text('no'),
),
FlatButton(
child: Text('yes'),
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
curve: Curves.bounceIn,
tooltip: 'Add account or instance',
child: Icon(Icons.add),
overlayColor: theme.canvasColor,
children: [
SpeedDialChild(
@ -179,6 +178,7 @@ class AccountsConfigPage extends HookWidget {
context: context, builder: (_) => AddInstancePage()),
),
],
child: Icon(Icons.add),
),
body: ListView(
children: [
@ -278,9 +278,9 @@ class _SectionHeading extends StatelessWidget {
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Padding(
padding: EdgeInsets.only(left: 20),
child: Text(text.toUpperCase(),
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,
children: [
FlatButton(
child: Text('Patreon'),
onPressed: () =>
openInBrowser('https://patreon.com/lemmur'),
child: Text('Patreon'),
),
FlatButton(
child: Text('Buy Me a Coffee'),
onPressed: () =>
openInBrowser('https://buymeacoff.ee/lemmur'),
child: Text('Buy Me a Coffee'),
),
],
),

View File

@ -302,6 +302,15 @@ class Comment extends HookWidget {
child: Column(
children: [
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(
children: [
Row(children: [
@ -329,12 +338,12 @@ class Comment extends HookWidget {
),
),
InkWell(
onTap: () => goToUser.byId(
context, comment.instanceHost, comment.creatorId),
child: Text(username,
style: TextStyle(
color: Theme.of(context).accentColor,
)),
onTap: () => goToUser.byId(
context, comment.instanceHost, comment.creatorId),
),
if (isOP) _CommentTag('OP', Theme.of(context).accentColor),
if (comment.banned) _CommentTag('BANNED', Colors.red),
@ -369,15 +378,6 @@ class Comment extends HookWidget {
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)
for (final c in newReplies.value.followedBy(commentTree.children))

View File

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