Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import java.util.Properties
import java.io.FileInputStream

val localProperties = Properties()
val localPropertiesFile = rootDir.resolve("local.properties")
if (localPropertiesFile.exists()) {
localProperties.load(FileInputStream(localPropertiesFile))
}
plugins {
id("com.android.application")
// START: FlutterFire Configuration
Expand All @@ -20,7 +13,7 @@ plugins {
android {
namespace = "uk.org.cherry.app"
compileSdk = flutter.compileSdkVersion
ndkVersion = localProperties.getProperty("flutter.ndkVersion")
ndkVersion = flutter.ndkVersion

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
Expand Down
2 changes: 2 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
# Project on D: with Pub cache on C: breaks Kotlin incremental compilation on Windows.
kotlin.incremental=false
3 changes: 3 additions & 0 deletions l10n.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart
16 changes: 9 additions & 7 deletions lib/features/auth/username_setup_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:cherry_mvp/core/config/config.dart';
import 'package:cherry_mvp/core/router/router.dart';
import 'package:cherry_mvp/core/services/services.dart';
import 'package:cherry_mvp/core/utils/utils.dart';
import 'package:cherry_mvp/l10n/app_localizations.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
Expand Down Expand Up @@ -70,15 +71,15 @@ class _UsernameSetupPageState extends State<UsernameSetupPage> {
if (!isTakenResult.isSuccess) {
setState(() {
_isSubmitting = false;
_errorText = isTakenResult.error ?? AppStrings.usernameSaveFailed;
_errorText = isTakenResult.error ?? AppLocalizations.of(context)!.authUsernameSaveFailed;
});
return;
}

if (isTakenResult.value == true) {
setState(() {
_isSubmitting = false;
_errorText = AppStrings.usernameTakenError;
_errorText = AppLocalizations.of(context)!.authUsernameTakenError;
});
return;
}
Expand All @@ -90,7 +91,7 @@ class _UsernameSetupPageState extends State<UsernameSetupPage> {
if (!saveResult.isSuccess) {
setState(() {
_isSubmitting = false;
_errorText = saveResult.error ?? AppStrings.usernameSaveFailed;
_errorText = saveResult.error ?? AppLocalizations.of(context)!.authUsernameSaveFailed;
});
return;
}
Expand All @@ -101,6 +102,7 @@ class _UsernameSetupPageState extends State<UsernameSetupPage> {

@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
return WillPopScope(
onWillPop: () async {
await _handleBack();
Expand Down Expand Up @@ -129,14 +131,14 @@ class _UsernameSetupPageState extends State<UsernameSetupPage> {
),
const SizedBox(height: 22),
Text(
AppStrings.usernameSetupTitle,
l10n.authUsernameSetupTitle,
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
fontWeight: FontWeight.w700,
),
),
const SizedBox(height: 8),
Text(
AppStrings.usernameSetupSubtitle,
l10n.authUsernameSetupSubtitle,
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
Expand All @@ -151,7 +153,7 @@ class _UsernameSetupPageState extends State<UsernameSetupPage> {
});
},
decoration: InputDecoration(
hintText: AppStrings.usernameSetupHint,
hintText: l10n.authUsernameSetupHint,
prefixIcon: const Icon(Icons.person_outline),
errorText: _errorText,
),
Expand All @@ -164,7 +166,7 @@ class _UsernameSetupPageState extends State<UsernameSetupPage> {
? const Center(child: CircularProgressIndicator())
: FilledButton(
onPressed: _isValid ? _saveUsername : null,
child: const Text(AppStrings.nextButton),
child: Text(l10n.commonNext),
),
),
],
Expand Down
9 changes: 6 additions & 3 deletions lib/features/checkout/checkout_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:cherry_mvp/features/checkout/payment_type.dart';
import 'package:cherry_mvp/features/checkout/widgets/basket_list_item.dart';
import 'package:cherry_mvp/features/checkout/widgets/delivery_options.dart';
import 'package:cherry_mvp/features/checkout/widgets/select_payment_type_bottom_sheet.dart';
import 'package:cherry_mvp/l10n/app_localizations.dart';

class CheckoutPage extends StatefulWidget {
const CheckoutPage({super.key});
Expand Down Expand Up @@ -46,21 +47,23 @@ class _CheckoutPageState extends State<CheckoutPage> {
final status = vm.createOrderStatus.type;

if (status == StatusType.failure) {
final l10n = AppLocalizations.of(context)!;
Fluttertoast.showToast(
msg: vm.createOrderStatus.message ?? "oops! Something went wrong",
msg: vm.createOrderStatus.message ?? l10n.checkoutSomethingWentWrongToast,
);
vm.resetCreateOrderStatus();
}

if (status == StatusType.success) {
Fluttertoast.showToast(msg: "Payment Successful");
Fluttertoast.showToast(msg: AppLocalizations.of(context)!.checkoutPaymentSuccessfulToast);
vm.resetCreateOrderStatus();
vm.gotoCheckoutComplete();
}
}

@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
final basket = context.read<CheckoutViewModel>();

return Scaffold(
Expand Down Expand Up @@ -216,7 +219,7 @@ class _CheckoutPageState extends State<CheckoutPage> {
color: Colors.white,
),
)
: Text(AppStrings.checkoutPay),
: Text(l10n.checkoutPayButton),
);
},
),
Expand Down
6 changes: 4 additions & 2 deletions lib/features/checkout/widgets/delivery_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'package:cherry_mvp/features/checkout/widgets/select_payment_type_bottom_
import 'package:cherry_mvp/features/checkout/widgets/share_location_dialog.dart';
import 'package:cherry_mvp/features/checkout/widgets/shipping_address_widget.dart';
import 'package:cherry_mvp/features/checkout/widgets/shipping_list_item.dart';
import 'package:cherry_mvp/l10n/app_localizations.dart';

class DeliveryOptions extends StatefulWidget {
const DeliveryOptions({super.key});
Expand Down Expand Up @@ -62,6 +63,7 @@ class _DeliveryOptionsState extends State<DeliveryOptions> {

@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
final basket = context.read<CheckoutViewModel>();
return SliverPadding(
padding: const EdgeInsets.symmetric(horizontal: 16),
Expand Down Expand Up @@ -232,7 +234,7 @@ class _DeliveryOptionsState extends State<DeliveryOptions> {
onChanged: (value) {
if (postcodeController.text.isEmpty && context.read<CheckoutViewModel>().selectedInpost == null) {
Fluttertoast.showToast(
msg: "Postcode required",
msg: l10n.checkoutPostcodeRequiredToast,
backgroundColor: AppColors.red,
textColor: AppColors.white,
);
Expand Down Expand Up @@ -343,7 +345,7 @@ class _DeliveryOptionsState extends State<DeliveryOptions> {
_delivery = null;
});
},
child: Text("Change pickup point"),
child: Text(l10n.checkoutChangePickupPoint),
),
),
CheckboxListTile(
Expand Down
6 changes: 4 additions & 2 deletions lib/features/checkout/widgets/share_location_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:cherry_mvp/core/config/config.dart';
import 'package:cherry_mvp/features/checkout/checkout_view_model.dart';
import 'package:cherry_mvp/l10n/app_localizations.dart';

class ShareLocationDialog extends StatelessWidget {
final String postcode;
const ShareLocationDialog({required this.postcode, super.key});

@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
return AlertDialog(
content: Column(
mainAxisSize: MainAxisSize.min,
Expand All @@ -26,12 +28,12 @@ class ShareLocationDialog extends StatelessWidget {
height: 43,
child: OutlinedButton(
onPressed: () => Navigator.pop(context),
child: Text(AppStrings.cancel),
child: Text(l10n.commonCancel),
),
),
FilledButton(
onPressed: () => context.read<CheckoutViewModel>().onConfirmLocation(postcode),
child: Text("Ok"),
child: Text(l10n.commonOk),
),
],
);
Expand Down
3 changes: 2 additions & 1 deletion lib/features/discover/discover_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:cherry_mvp/l10n/app_localizations.dart';

import 'package:cherry_mvp/features/discover/discover_viewmodel.dart';
import 'package:cherry_mvp/features/discover/widgets/discover_charity_list.dart';
Expand All @@ -21,7 +22,7 @@ class DiscoverPage extends StatelessWidget {
child: CustomScrollView(
slivers: [
SliverAppBar(
title: Text('Discover'),
title: Text(AppLocalizations.of(context)!.navDiscoverTitle),
floating: true,
primary: false,
snap: true,
Expand Down
8 changes: 5 additions & 3 deletions lib/features/discover/widgets/discover_selection_bar.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:cherry_mvp/l10n/app_localizations.dart';
import 'package:flutter/material.dart';

class DiscoverSelectionBar extends StatefulWidget {
Expand All @@ -10,6 +11,7 @@ class DiscoverSelectionBar extends StatefulWidget {
class _DiscoverSelectionBarState extends State<DiscoverSelectionBar> {
@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
return Container(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surfaceContainerHighest,
Expand All @@ -27,7 +29,7 @@ class _DiscoverSelectionBarState extends State<DiscoverSelectionBar> {
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 4, vertical: 8),
child: Text(
"Popular",
l10n.navPopularSegment,
style: Theme.of(context).textTheme.titleSmall?.copyWith(
color: Theme.of(context).colorScheme.primary,
),
Expand All @@ -40,7 +42,7 @@ class _DiscoverSelectionBarState extends State<DiscoverSelectionBar> {
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 4, vertical: 8),
child: Text(
"Smaller Charities",
l10n.navSmallerCharitiesSegment,
style: Theme.of(context).textTheme.titleSmall?.copyWith(
color: Theme.of(context).colorScheme.secondary,
),
Expand All @@ -52,7 +54,7 @@ class _DiscoverSelectionBarState extends State<DiscoverSelectionBar> {
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 4, vertical: 8),
child: Text(
"Local to you",
l10n.navLocalToYouSegment,
style: Theme.of(context).textTheme.titleSmall?.copyWith(
color: Theme.of(context).colorScheme.secondary,
),
Expand Down
12 changes: 7 additions & 5 deletions lib/features/home/widgets/bottom_nav_bar.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:cherry_mvp/core/config/app_images.dart';
import 'package:cherry_mvp/features/search/widgets/search.dart';
import 'package:cherry_mvp/l10n/app_localizations.dart';
import 'package:flutter/material.dart';

/// A reusable navigation bar widget that be use across the app.
Expand All @@ -19,6 +20,7 @@ class CherryBottomNavBar extends StatelessWidget {

@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
final selectedColor =
this.selectedColor ?? Theme.of(context).colorScheme.primary;
final unselectedColor =
Expand Down Expand Up @@ -53,7 +55,7 @@ class CherryBottomNavBar extends StatelessWidget {
height: 24,
color: selectedIndex == 0 ? selectedColor : unselectedColor,
),
label: 'Home',
label: l10n.navHome,
),
BottomNavigationBarItem(
icon: Image.asset(
Expand All @@ -62,7 +64,7 @@ class CherryBottomNavBar extends StatelessWidget {
height: 24,
color: selectedIndex == 1 ? selectedColor : unselectedColor,
),
label: 'Inbox',
label: l10n.navInbox,
),
BottomNavigationBarItem(
icon: Image.asset(
Expand All @@ -71,11 +73,11 @@ class CherryBottomNavBar extends StatelessWidget {
height: 24,
color: selectedIndex == 2 ? selectedColor : unselectedColor,
),
label: 'Give',
label: l10n.navGive,
),
BottomNavigationBarItem(
icon: Search(),
label: 'Search',
label: l10n.navSearch,
),
BottomNavigationBarItem(
icon: Image.asset(
Expand All @@ -84,7 +86,7 @@ class CherryBottomNavBar extends StatelessWidget {
height: 24,
color: selectedIndex == 4 ? selectedColor : unselectedColor,
),
label: 'Profile',
label: l10n.navProfile,
),
],
),
Expand Down
3 changes: 2 additions & 1 deletion lib/features/login/login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:provider/provider.dart';
import 'package:cherry_mvp/core/config/config.dart';
import 'package:cherry_mvp/features/login/login_viewmodel.dart';
import 'package:cherry_mvp/features/login/widgets/login_form.dart';
import 'package:cherry_mvp/l10n/app_localizations.dart';

class LoginPage extends StatelessWidget {
const LoginPage({super.key});
Expand All @@ -19,7 +20,7 @@ class LoginPage extends StatelessWidget {
),
onPressed: () => context.read<LoginViewModel>().goBack(),
),
title: const Text('Login'),
title: Text(AppLocalizations.of(context)!.authLoginButton),
),
body: const LoginForm(),
);
Expand Down
Loading