Skip to content

Commit

Permalink
refactor: Flutter v3.7.0 (#3642)
Browse files Browse the repository at this point in the history
  • Loading branch information
M123-dev authored Jan 31, 2023
1 parent e9236a4 commit ad7ac77
Show file tree
Hide file tree
Showing 203 changed files with 1,908 additions and 1,660 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@ jobs:
with:
channel: stable
cache: true
flutter-version: '3.0.5'
#cache-key: ${{ inputs.FLUTTER-CACHE-KEY }}
cache-key: revert-3.0.5
flutter-version: '3.7.0'
cache-key: flutter-3.7.0-${{ hashFiles('**/pubspec.lock') }}

- name: Flutter version
run: flutter --version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,8 @@ jobs:
with:
channel: stable
cache: true
flutter-version: '3.0.5'
#cache-key: ${{ inputs.FLUTTER-CACHE-KEY }}
cache-key: revert-3.0.5
flutter-version: '3.7.0'
cache-key: flutter-3.7.0-${{ hashFiles('**/pubspec.lock') }}

- name: Flutter version
run: flutter --version
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/postsubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ jobs:
with:
channel: stable
cache: true
flutter-version: '3.0.5'
#cache-key: flutter-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock')}}
cache-key: revert-3.0.5
flutter-version: '3.7.0'
cache-key: flutter-3.7.0-${{ hashFiles('**/pubspec.lock') }}

- run: flutter --version

Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ jobs:
with:
channel: stable
cache: true
flutter-version: '3.0.5'
#cache-key: flutter-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock')}}
cache-key: revert-3.0.5
flutter-version: '3.7.0'
cache-key: flutter-3.7.0-${{ hashFiles('**/pubspec.lock') }}

- run: flutter --version

Expand Down
51 changes: 24 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,36 @@
[![Create internal releases](https://github.com/openfoodfacts/smooth-app/actions/workflows/internal-release.yml/badge.svg)](https://github.com/openfoodfacts/smooth-app/actions/workflows/internal-release.yml)

## Weekly meetings

- We e-meet Thursdays at 17:30 Paris Time (16:30 London Time, 22:00 IST, 08:30 AM PT)
- ![Google Meet](https://img.shields.io/badge/Google%20Meet-00897B?logo=google-meet&logoColor=white) Video call link: https://meet.google.com/gnp-frks-esc
- Join by phone: https://tel.meet/gnp-frks-esc?pin=1110549945262
- ![Google Meet](https://img.shields.io/badge/Google%20Meet-00897B?logo=google-meet&logoColor=white) Video call link: <https://meet.google.com/gnp-frks-esc>
- Join by phone: <https://tel.meet/gnp-frks-esc?pin=1110549945262>
- Add the Event to your Calendar by [adding the Open Food Facts community calendar to your calendar](https://wiki.openfoodfacts.org/Events)
- [Weekly Agenda](https://docs.google.com/document/d/1MGQqMV7M4JTjFcRsiRvMZ8bnmd9vJWdSyRR3wJHUBMk/edit): please add the Agenda items as early as you can. Make sure to check the Agenda items in advance of the meeting, so that we have the most informed discussions possible, leading to argumented decisions.
- [Weekly Agenda](https://docs.google.com/document/d/1MGQqMV7M4JTjFcRsiRvMZ8bnmd9vJWdSyRR3wJHUBMk/edit): please add the Agenda items as early as you can. Make sure to check the Agenda items in advance of the meeting, so that we have the most informed discussions possible, leading to argumented decisions.
- The meeting will handle Agenda items first, and if time permits, collaborative bug triage.
- We strive to timebox the core of the meeting (decision making) to 30 minutes, with an optional free discussion/live debugging afterwards.
- We take comprehensive notes in the Weekly Agenda of agenda item discussions and of decisions taken.

## User interface
- [![Figma](https://img.shields.io/badge/figma-%23F24E1E.svg?logo=figma&logoColor=white) Mockups on the current app and future plans to discuss](https://www.figma.com/file/nFMjewFAOa8c4ahtob7CAB/Mobile-App-Design-(Quentin)?node-id=0%3A1&t=SrBuT7gBdhapUerx-0)

- [![Figma](https://img.shields.io/badge/figma-%23F24E1E.svg?logo=figma&logoColor=white) Mockups on the current app and future plans to discuss](https://www.figma.com/file/nFMjewFAOa8c4ahtob7CAB/Mobile-App-Design-(Quentin)?node-id=0%3A1&t=SrBuT7gBdhapUerx-0)

## Feature Sprint

## Feature Sprint
- We use feature-based sprints, [tracked here](https://github.com/orgs/openfoodfacts/projects/83)

## Code documentation
[Code documentation on GitHub pages](https://openfoodfacts.github.io/smooth-app/).

## Alert!

We are currently using Flutter 3.0.5 as the new 3.3.0 [has some bugs](https://github.com/openfoodfacts/smooth-app/issues/2919).

Running `flutter downgrade 3.0.5` downgrades the version.
[Code documentation on GitHub pages](https://openfoodfacts.github.io/smooth-app/).

------
## Current Release

Latest commit deployed to Apple App Store: Released on Nov 29th as Build 835
Latest commit deployed to PlayStore: 792 from Nov 6th 11AM

## Presentation

- This new mobile application aims to showcase Open Food Facts's power to a broad range of users through a smooth user experience and sleek user interface. It is a <b> Flutter application </b> by [Open Food Facts](https://github.com/openfoodfacts).
- This new mobile application aims to showcase Open Food Facts's power to a broad range of users through a smooth user experience and sleek user interface. It is a <b> Flutter application </b> by [Open Food Facts](https://github.com/openfoodfacts).
- We pioneered the collaborative scanning app in 2012. With this experimental app, we’re reinventing it from the ground up.
- Install it on [Android](https://play.google.com/store/apps/details?id=org.openfoodfacts.scanner) or [iPhone/iPad](https://apps.apple.com/app/open-food-facts/id588797948). Note that a internal development build ([Android](https://play.google.com/apps/internaltest/4699092342921529278) or [iPhone/iPad](https://testflight.apple.com/join/c2tiBHgd) )if you'd like to use the results of your PRs quicker.

Expand All @@ -58,14 +54,18 @@ Latest commit deployed to PlayStore: 792 from Nov 6th 11AM
<details><summary><h2> Features of the app </h2></summary>

## Features

- a scan that truly matches who you are (Green: the product matches your criteria, Red: there is a problem, Gray: Help us answer you by photographing the products)
- a product page that's knowledgeable, building on the vast amount of food facts we collect collaboratively, and other sources of knowledge, to help you make better food decisions
## You can :

## You can

- scan and compare in 15 seconds the 3 brands of tomato sauces left on the shelf, on your terms.
- get a tailored comparison of any food category
- set your preferences without ruining your privacy

## Criteria you can pick :
## Criteria you can pick

- Environment: Eco-Score
- Health: Additives & Ultra processed foods, Salt, Allergens, Nutri-Score

Expand All @@ -82,15 +82,15 @@ Latest commit deployed to PlayStore: 792 from Nov 6th 11AM

<br>


## How to run the project

- Make sure you have installed flutter and all the requirements
- [Official flutter installation guide](https://docs.flutter.dev/get-started/install)
- Currently the app uses `3.0.5` flutter version. Running `flutter downgrade 3.0.5` downgrades the version.
- [Official flutter installation guide](https://docs.flutter.dev/get-started/install)
- Currently the app uses `3.7.0` flutter version. If you are using a later version you can use `flutter downgrade 3.7.0` to downgrades the version.

If it does not work
- Open the terminal and change the directory to flutter location and run the following commands
- `git checkout 3.0.5`
- Open the terminal and change the directory to flutter location and run the following commands
- `git checkout 3.7.0`
- `flutter doctor`

We have predefined run configurations for Android Studio and Visual Studio Code
Expand All @@ -103,18 +103,15 @@ In order to run the application, make sure you are in the `packages/smooth_app`

- On iOS 🍎: `flutter run -t lib/entrypoints/ios/main_ios.dart`

- Troubleshooting🚀: If you get an error like `App depends on scanner shared from path which depends on camera_platform_interface from git, version solving failed.` then run
- `flutter pub cache clean` or mannually delete the
- `C:\Users\~\AppData\Local\Pub\Cache` file .
Then redo the above procedure to run the app.

- Troubleshooting🚀: If you get an error like `App depends on scanner shared from path which depends on camera_platform_interface from git, version solving failed.` then run
- `flutter pub cache clean` or manually delete the
- `C:\Users\~\AppData\Local\Pub\Cache` file .
Then redo the above procedure to run the app.

- [Contributing Guidelines](https://github.com/openfoodfacts/smooth-app/blob/develop/CONTRIBUTING.md)

<br>



<details><summary><h3>Thanks</h3></summary>
The app was initially created by Primael. The new Open Food Facts app (smooth_app) was then made possible thanks to an initial grant by the Mozilla Foundation in February 2020, after Pierre pitched them the idea at FOSDEM. A HUGE THANKS 🧡
In addition to the core role of the community, we also had the support from several Google.org fellows and a ShareIt fellow that helped us eventually release the app in June 2022.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:typed_data';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:google_mlkit_barcode_scanning/google_mlkit_barcode_scanning.dart';
Expand Down
6 changes: 3 additions & 3 deletions packages/smooth_app/lib/background/background_task_badge.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:badges/badges.dart';
import 'package:badges/badges.dart' as badges;
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:smooth_app/database/local_database.dart';
Expand All @@ -16,14 +16,14 @@ class BackgroundTaskBadge extends StatelessWidget {
if (tasks.isEmpty) {
return child;
}
return Badge(
return badges.Badge(
badgeColor: Colors.blue.shade900,
showBadge: true,
badgeContent: Text(
'${tasks.length}',
style: const TextStyle(color: Colors.white),
),
position: BadgePosition.topStart(start: -16),
position: badges.BadgePosition.topStart(start: -16),
child: child,
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'dart:io';
import 'dart:typed_data';

import 'package:flutter/foundation.dart';
import 'package:path/path.dart';
Expand Down
3 changes: 2 additions & 1 deletion packages/smooth_app/lib/cards/data_cards/score_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ class ScoreCard extends StatelessWidget {
child: Center(
child: Text(
description,
style: themeData.textTheme.headline4!.apply(color: textColor),
style: themeData.textTheme.headlineMedium!
.apply(color: textColor),
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class _ProductTitleCardName extends StatelessWidget {

return Text(
getProductName(product, appLocalizations),
style: Theme.of(context).textTheme.headline4,
style: Theme.of(context).textTheme.headlineMedium,
textAlign: TextAlign.start,
).selectable(isSelectable: selectable);
}
Expand Down Expand Up @@ -105,7 +105,7 @@ class _ProductTitleCardBrand extends StatelessWidget {

return Text(
subtitleText,
style: Theme.of(context).textTheme.bodyText2,
style: Theme.of(context).textTheme.bodyMedium,
textAlign: TextAlign.start,
).selectable(isSelectable: selectable);
}
Expand Down Expand Up @@ -149,7 +149,7 @@ class _ProductTitleCardTrailing extends StatelessWidget {
} else {
return Text(
product.quantity ?? '',
style: Theme.of(context).textTheme.headline3,
style: Theme.of(context).textTheme.displaySmall,
textAlign: TextAlign.end,
).selectable(isSelectable: selectable);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class SmoothProductCardError extends StatelessWidget {
),
Text(
barcode,
style: Theme.of(context).textTheme.subtitle1,
style: Theme.of(context).textTheme.titleMedium,
),
const SizedBox(
height: MEDIUM_SPACE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ class SmoothProductCardFound extends StatelessWidget {
Text(
getProductName(product, appLocalizations),
overflow: TextOverflow.ellipsis,
style: themeData.textTheme.headline4,
style: themeData.textTheme.headlineMedium,
),
Text(
getProductBrands(product, appLocalizations),
overflow: TextOverflow.ellipsis,
style: themeData.textTheme.subtitle1,
style: themeData.textTheme.titleMedium,
),
Row(
children: <Widget>[
Expand All @@ -131,7 +131,8 @@ class SmoothProductCardFound extends StatelessWidget {
alignment: AlignmentDirectional.centerStart,
child: Text(
helper.getSubtitle(appLocalizations),
style: themeData.textTheme.bodyText2!.apply(
style:
themeData.textTheme.bodyMedium!.apply(
color: helper
.getButtonForegroundColor(isDarkMode),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class SmoothProductCardLoading extends StatelessWidget {
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(barcode, style: Theme.of(context).textTheme.subtitle1),
Text(barcode, style: Theme.of(context).textTheme.titleMedium),
],
),
const SizedBox(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class SmoothProductCardNotFound extends StatelessWidget {
RichText(
textAlign: TextAlign.center,
text: TextSpan(
style: textTheme.headline5,
style: textTheme.headlineSmall,
children: <InlineSpan>[
TextSpan(
text: appLocalizations.missing_product,
style: textTheme.headline2,
style: textTheme.displayMedium,
),
const WidgetSpan(
alignment: PlaceholderAlignment.belowBaseline,
Expand All @@ -42,11 +42,11 @@ class SmoothProductCardNotFound extends StatelessWidget {
),
TextSpan(
text: '\n${appLocalizations.add_product_take_photos}\n',
style: textTheme.bodyText2,
style: textTheme.bodyMedium,
),
TextSpan(
text: '(${appLocalizations.barcode_barcode(barcode)})',
style: textTheme.bodyText2,
style: textTheme.bodyMedium,
),
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class SmoothLargeButtonWithIcon extends StatelessWidget {
child: AutoSizeText(
text,
maxLines: 2,
style: themeData.textTheme.bodyText2!.copyWith(
style: themeData.textTheme.bodyMedium!.copyWith(
color: themeData.colorScheme.onSecondary,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class _SmoothDialogTitle extends StatelessWidget {
child: FittedBox(
child: Text(
label,
style: Theme.of(context).textTheme.headline2,
style: Theme.of(context).textTheme.displayMedium,
),
),
),
Expand Down Expand Up @@ -378,7 +378,7 @@ class _SmoothActionElevatedButton extends StatelessWidget {
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
maxLines: buttonData.lines ?? 2,
style: themeData.textTheme.bodyText2!.copyWith(
style: themeData.textTheme.bodyMedium!.copyWith(
fontWeight: FontWeight.bold,
color: buttonData.textColor ?? themeData.colorScheme.onPrimary,
),
Expand Down Expand Up @@ -413,7 +413,7 @@ class _SmoothActionFlatButton extends StatelessWidget {
shape: const RoundedRectangleBorder(
borderRadius: ROUNDED_BORDER_RADIUS,
),
textStyle: themeData.textTheme.bodyText2!.copyWith(
textStyle: themeData.textTheme.bodyMedium!.copyWith(
color: themeData.colorScheme.onPrimary,
),
padding: const EdgeInsets.symmetric(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class SmoothImagesSliverList extends SmoothImagesView {
appLocalizations,
imageList[index].key.imageField,
),
style: themeData.textTheme.headline4,
style: themeData.textTheme.headlineMedium,
),
onTap: onTap == null
? null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ class _SmoothErrorCardState extends State<SmoothErrorCard> {
children: <Widget>[
Text(
_appLocalizations.error_occurred,
style: Theme.of(context).textTheme.bodyText2?.apply(
style: Theme.of(context).textTheme.bodyMedium?.apply(
fontWeightDelta: 500,
color: Colors.red,
),
),
const SizedBox(height: VERY_LARGE_SPACE),
Text(
widget.errorMessage,
style: Theme.of(context).textTheme.bodyText2?.apply(
style: Theme.of(context).textTheme.bodyMedium?.apply(
fontWeightDelta: 500,
),
).selectable(),
Expand Down
2 changes: 2 additions & 0 deletions packages/smooth_app/lib/helpers/extension_on_text_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ extension Selectable on Text {
textScaleFactor: textScaleFactor,
textAlign: textAlign,
maxLines: maxLines,
// TODO(m123): Fix or remove alltogether
// ignore: deprecated_member_use
toolbarOptions: const ToolbarOptions(
copy: true,
selectAll: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/lib/helpers/permission_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class PermissionListener extends ValueNotifier<DevicePermission> {
super.value = newValue;

Logs.d(
'New permission value: ${newValue.toString()}',
'New permission value: $newValue',
tag: 'PermissionListener',
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class KnowledgePanelGroupCard extends StatelessWidget {
padding: const EdgeInsetsDirectional.only(top: LARGE_SPACE),
child: Text(
groupElement.title!,
style: themeData.textTheme.subtitle2!.apply(color: Colors.grey),
style:
themeData.textTheme.titleSmall!.apply(color: Colors.grey),
),
),
for (String panelId in groupElement.panelIds)
Expand Down
Loading

0 comments on commit ad7ac77

Please sign in to comment.