Skip to content

Commit

Permalink
Check overall padding
Browse files Browse the repository at this point in the history
  • Loading branch information
viplmad committed Jan 29, 2024
1 parent aebd7f2 commit f33109c
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 83 deletions.
23 changes: 6 additions & 17 deletions lib/ui/common/header_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@ class ListHeader extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(
left: 16.0,
right: 24.0,
top: 8.0,
bottom: 8.0,
),
padding: FieldUtils.tilePadding,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expand Down Expand Up @@ -54,12 +49,7 @@ class ListHeaderSkeleton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return const Padding(
padding: EdgeInsets.only(
left: 16.0,
right: 24.0,
top: 10.0,
bottom: 10.0,
),
padding: FieldUtils.tilePadding,
child: SizedBox(
width: FieldUtils.titleTextWidth,
height: FieldUtils.titleTextHeight,
Expand Down Expand Up @@ -129,11 +119,10 @@ class ExtendedFieldListTile extends StatelessWidget {
onTap: onTap,
onLongPress: onLongPress,
child: Padding(
padding: EdgeInsets.only(
left: 16.0,
right: center ? 16.0 : 24.0,
top: 8.0,
bottom: 8.0,
padding: FieldUtils.tilePadding.copyWith(
right: center
? FieldUtils.tilePadding.left
: FieldUtils.tilePadding.right,
),
child: Column(
crossAxisAlignment:
Expand Down
10 changes: 6 additions & 4 deletions lib/ui/common/list_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import 'package:game_oclock/ui/theme/theme.dart' show AppTheme;
import 'header_text.dart';
import 'skeleton.dart';

const EdgeInsets _listItemPadding = EdgeInsets.all(4.0);

class ItemListBuilder extends StatelessWidget {
const ItemListBuilder({
Key? key,
Expand Down Expand Up @@ -41,7 +43,7 @@ class ItemListBuilder extends StatelessWidget {
itemCount: itemCount,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: const EdgeInsets.all(4.0),
padding: _listItemPadding,
child: ShapeUtils.forceCardRound(
itemBuilder(context, index),
),
Expand Down Expand Up @@ -87,7 +89,7 @@ class ItemGridBuilder extends StatelessWidget {
),
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: const EdgeInsets.all(4.0),
padding: _listItemPadding,
child: ShapeUtils.forceCardRound(
itemBuilder(context, index),
),
Expand Down Expand Up @@ -121,7 +123,7 @@ class ItemSliverCardSectionBuilder extends StatelessWidget {
itemCount: itemCount,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: const EdgeInsets.all(4.0),
padding: _listItemPadding,
child: ShapeUtils.forceCardRound(
itemBuilder(context, index),
),
Expand Down Expand Up @@ -160,7 +162,7 @@ class ItemSliverGridSectionBuilder extends StatelessWidget {
),
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: const EdgeInsets.all(4.0),
padding: _listItemPadding,
child: ShapeUtils.forceCardRound(
itemBuilder(context, index),
),
Expand Down
61 changes: 22 additions & 39 deletions lib/ui/connect.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:logic/bloc/connection/connection.dart';
import 'package:logic/service/service.dart' show GameOClockService;

import 'package:game_oclock/ui/common/list_view.dart';

import 'route_constants.dart';
import 'theme/theme.dart' show AppTheme;

Expand Down Expand Up @@ -80,47 +82,28 @@ class _ConnectpageBody extends StatelessWidget {
);
}
if (state is FailedConnection) {
return Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Center(
child: Text(
AppLocalizations.of(context)!.failedConnectionString,
),
),
ElevatedButton(
onPressed: () {
BlocProvider.of<ConnectionBloc>(context)
.add(Connect());
},
style: ElevatedButton.styleFrom(
surfaceTintColor:
AppTheme.defaultThemeSurfaceTintColor(context),
),
child: Text(
AppLocalizations.of(context)!.retryString,
),
return ItemError(
title: AppLocalizations.of(context)!.failedConnectionString,
onRetryTap: () {
BlocProvider.of<ConnectionBloc>(context).add(Connect());
},
additionalWidgets: <Widget>[
ElevatedButton(
onPressed: () async {
Navigator.pushReplacementNamed(
context,
serverSettingsRoute,
);
},
style: ElevatedButton.styleFrom(
surfaceTintColor:
AppTheme.defaultThemeSurfaceTintColor(context),
),
ElevatedButton(
onPressed: () async {
Navigator.pushReplacementNamed(
context,
serverSettingsRoute,
);
},
style: ElevatedButton.styleFrom(
surfaceTintColor:
AppTheme.defaultThemeSurfaceTintColor(context),
),
child: Text(
AppLocalizations.of(context)!.changeRepositoryString,
),
child: Text(
AppLocalizations.of(context)!.changeRepositoryString,
),
],
),
),
],
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/ui/detail/item_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ abstract class ItemDetailBody<
body: RefreshIndicator(
onRefresh: () async => reloadItem(context),
child: ListView(
padding: EdgeInsets.zero,
padding: const EdgeInsets.only(top: 16.0),
children: <Widget>[
BlocBuilder<K, ItemDetailState>(
builder: (BuildContext context, ItemDetailState state) {
Expand Down
31 changes: 14 additions & 17 deletions lib/ui/relation/item_relation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -293,23 +293,20 @@ class _LinkButton<W extends PrimaryModel> extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(left: 4.0, right: 4.0),
child: ElevatedButton.icon(
label: Text(AppLocalizations.of(context)!.linkString(typeName)),
icon: const Icon(AppTheme.linkIcon),
onPressed: () async {
onSearch().then((W? result) {
if (result != null) {
updateAdd(result);
}
});
},
style: ElevatedButton.styleFrom(
foregroundColor: AppTheme.defaultThemeTextColor(context),
backgroundColor: AppTheme.defaultBackgroundColor(context),
surfaceTintColor: AppTheme.defaultThemeSurfaceTintColor(context),
),
return ElevatedButton.icon(
label: Text(AppLocalizations.of(context)!.linkString(typeName)),
icon: const Icon(AppTheme.linkIcon),
onPressed: () async {
onSearch().then((W? result) {
if (result != null) {
updateAdd(result);
}
});
},
style: ElevatedButton.styleFrom(
foregroundColor: AppTheme.defaultThemeTextColor(context),
backgroundColor: AppTheme.defaultBackgroundColor(context),
surfaceTintColor: AppTheme.defaultThemeSurfaceTintColor(context),
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/review/review_year.dart
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ class _ReviewYearBody extends StatelessWidget {
final int ratingTotalRated = totalRatedByRating[index + 1] ?? 0;
return ratingTotalRated;
}).toList(growable: false),
onDomainTap: onRatingTap,
onDomainTap: (int domainIndex) => onRatingTap(domainIndex + 1),
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/ui/search/item_search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class _ItemSearchBodyState<
widget.allowNewButton
? Container(
color: Colors.grey,
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: _newButton(),
)
: const SizedBox(),
Expand Down
9 changes: 9 additions & 0 deletions lib/ui/utils/field_utils.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:flutter/material.dart';

class FieldUtils {
FieldUtils._();

Expand All @@ -9,4 +11,11 @@ class FieldUtils {

static const double imageWidth = 100;
static const double imageHeight = 56;

static const EdgeInsets tilePadding = EdgeInsets.only(
left: 16.0,
right: 24.0,
top: 8.0,
bottom: 8.0,
);
}
2 changes: 1 addition & 1 deletion logic/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ packages:
description:
path: "."
ref: main
resolved-ref: a5c98ac99fa850edcec7553c4e2d9c714f1c8593
resolved-ref: d31001dce5bbb515978a1d10d17b033f9dde97c9
url: "https://github.com/viplmad/game-oclock-client-dart.git"
source: git
version: "1.3.7+52"
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ packages:
description:
path: "."
ref: main
resolved-ref: a5c98ac99fa850edcec7553c4e2d9c714f1c8593
resolved-ref: d31001dce5bbb515978a1d10d17b033f9dde97c9
url: "https://github.com/viplmad/game-oclock-client-dart.git"
source: git
version: "1.3.7+52"
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: game_oclock
description: A simple game collection manager.
version: 3.3.2+386
version: 3.3.3+404
publish_to: none

environment:
Expand Down

0 comments on commit f33109c

Please sign in to comment.