Skip to content

Commit

Permalink
fix: Smaller UI stylings
Browse files Browse the repository at this point in the history
  • Loading branch information
TomBursch committed Sep 13, 2024
1 parent 55a721e commit 3dc212b
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 9 deletions.
12 changes: 11 additions & 1 deletion kitchenowl/lib/enums/views_enum.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,17 @@ enum ViewsEnum {
IconData toIcon(BuildContext context) {
return [
Icons.shopping_bag_outlined,
Icons.receipt,
Icons.receipt_outlined,
Icons.calendar_today_outlined,
Icons.account_balance_outlined,
App.isOffline ? Icons.cloud_off_rounded : Icons.person_outline_rounded,
][index];
}

IconData toSelectedIcon(BuildContext context) {
return [
Icons.shopping_bag_rounded,
Icons.receipt_rounded,
Icons.calendar_today_rounded,
Icons.account_balance_rounded,
App.isOffline ? Icons.cloud_off_rounded : Icons.person_rounded,
Expand Down
1 change: 1 addition & 0 deletions kitchenowl/lib/pages/household_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ class _HouseholdPageState extends State<HouseholdPage> {
destinations: pages
.map((e) => NavigationDestination(
icon: Icon(e.toIcon(context)),
selectedIcon: Icon(e.toSelectedIcon(context)),
label: e.toLocalizedShortString(context),
tooltip: e.toLocalizedString(context),
))
Expand Down
38 changes: 33 additions & 5 deletions kitchenowl/lib/pages/household_page/household_drawer.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_blurhash/flutter_blurhash.dart';
import 'package:go_router/go_router.dart';
import 'package:kitchenowl/app.dart';
import 'package:kitchenowl/cubits/auth_cubit.dart';
import 'package:kitchenowl/cubits/household_cubit.dart';
import 'package:kitchenowl/enums/update_enum.dart';
import 'package:kitchenowl/enums/views_enum.dart';
import 'package:kitchenowl/kitchenowl.dart';
import 'package:transparent_image/transparent_image.dart';

class HouseholdDrawer extends StatelessWidget {
final int selectedIndex;
Expand Down Expand Up @@ -55,11 +57,36 @@ class HouseholdDrawer extends StatelessWidget {
BlocBuilder<HouseholdCubit, HouseholdState>(
builder: (context, state) => Padding(
padding: const EdgeInsets.fromLTRB(28, 16, 16, 10),
child: Text(
state.household.name,
style: Theme.of(context).textTheme.titleSmall,
maxLines: 1,
overflow: TextOverflow.ellipsis,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
if (state.household.image != null)
Padding(
padding: const EdgeInsets.only(bottom: 16),
child: ClipRRect(
borderRadius: BorderRadius.circular(14),
child: SizedBox(
height: 150,
child: FadeInImage(
fit: BoxFit.cover,
placeholder: state.household.imageHash != null
? BlurHashImage(state.household.imageHash!)
: MemoryImage(kTransparentImage) as ImageProvider,
image: getImageProvider(
context,
state.household.image!,
),
),
),
),
),
Text(
state.household.name,
style: Theme.of(context).textTheme.titleSmall,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
),
),
Expand All @@ -72,6 +99,7 @@ class HouseholdDrawer extends StatelessWidget {
overflow: TextOverflow.ellipsis,
),
icon: Icon(destination.toIcon(context)),
selectedIcon: Icon(destination.toSelectedIcon(context)),
);
},
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ class HouseholdNavigationRail extends StatelessWidget {
label: Text(AppLocalizations.of(context)!.more),
),
...pages.map((e) => NavigationRailDestination(
icon: Icon(e.toIcon(context)),
label: Text(e.toLocalizedString(context)),
icon: Icon(e.toIcon(context)),
selectedIcon: Icon(e.toSelectedIcon(context)),
)),
],
selectedIndex: selectedIndex + 1,
Expand Down
16 changes: 15 additions & 1 deletion kitchenowl/lib/pages/settings_user_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,20 @@ class _SettingsUserPageState extends State<SettingsUserPage> {
labelText: AppLocalizations.of(context)!.name,
),
),
if (cubit.userId == null && App.isDefaultServer) ...[
const SizedBox(height: 8),
Text(
AppLocalizations.of(context)!.accountCreateHint,
style:
Theme.of(context).textTheme.labelMedium?.copyWith(
color: Theme.of(context)
.textTheme
.labelMedium
?.color
?.withOpacity(0.8),
),
),
],
const SizedBox(height: 8),
if (cubit.userId != null)
BlocBuilder<SettingsUserCubit, SettingsUserState>(
Expand All @@ -211,7 +225,7 @@ class _SettingsUserPageState extends State<SettingsUserPage> {
),
const SizedBox(height: 8),
Padding(
padding: const EdgeInsets.only(bottom: 32),
padding: const EdgeInsets.only(bottom: 24),
child: LoadingElevatedButton(
onPressed: () => cubit.updateUser(
context: context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ViewSettingsListTile<Cubit extends HouseholdAddUpdateCubit>
title: Text(
view.toLocalizedString(context),
),
leading: Icon(view.toIcon(context)),
leading: Icon(view.toSelectedIcon(context)),
contentPadding: EdgeInsets.only(left: 16),
trailing: Row(
mainAxisSize: MainAxisSize.min,
Expand Down

0 comments on commit 3dc212b

Please sign in to comment.