1
0
mirror of https://github.com/flutter/samples.git synced 2026-06-25 15:49:43 +00:00

22 Commits

Author SHA1 Message Date
Harsh Yadav
7e12f75def Migrate compass_app to SharedPreferencesAsync (#2841)
## Description

Migrated `SharedPreferences` usage in `compass_app` to
`SharedPreferencesAsync` to align with the latest `shared_preferences`
recommendations.

### Changes made

* Replaced `SharedPreferences.getInstance()` usages
* Updated async preference reads with awaited getters
* Migrated token persistence logic
* Updated test setup preference clearing logic

Fixes #2720

## Pre-launch Checklist

* [x] I read the [[Flutter Style
Guide](https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md)]
*recently*, and have followed its advice.
* [x] I signed the [[CLA](https://cla.developers.google.com/)].
* [x] I read the [[Contributors
Guide](https://github.com/flutter/samples/blob/main/CONTRIBUTING.md)].
* [ ] I have added sample code updates to the
[[changelog](https://chatgpt.com/CHANGELOG.md)].
* [ ] I updated/added relevant documentation (doc comments with `///`).

<!-- Links -->

[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md
[CLA]: https://cla.developers.google.com/
[Discord]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md
[Contributors Guide]:
https://github.com/flutter/samples/blob/main/CONTRIBUTING.md
[changelog]: ../CHANGELOG.md

Co-authored-by: Eric Windmill <eric@ericwindmill.com>
2026-06-19 15:02:33 -07:00
Eric Windmill
d9a2b781a2 Various simple fixes (#2866)
*Replace this paragraph with a description of what this PR is changing
or adding, and why. Consider including before/after screenshots.*

*List which issues are fixed by this PR. For larger changes, raising an
issue first helps
reduce redundant work.*

## Pre-launch Checklist

- [ ] I read the [Flutter Style Guide] _recently_, and have followed its
advice.
- [ ] I signed the [CLA].
- [ ] I read the [Contributors Guide].
- [ ] I have added sample code updates to the [changelog].
- [ ] I updated/added relevant documentation (doc comments with `///`).


If you need help, consider asking for advice on the #hackers-devrel
channel on [Discord].

<!-- Links -->
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md
[CLA]: https://cla.developers.google.com/
[Discord]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md
[Contributors Guide]:
https://github.com/flutter/samples/blob/main/CONTRIBUTING.md
[changelog]: ../CHANGELOG.md
2026-06-19 14:54:02 -07:00
Harsh Yadav
659acd0690 refactor: remove redundant notifyListeners in HomeViewModel deleteBooking (#2839)
Removes redundant notifyListeners() call from _deleteBooking().

The method is executed through Command, which already manages its own
notifyListeners lifecycle. This change ensures that HomeViewModel
only notifies listeners when its internal state (_bookings) changes,
avoiding unnecessary updates.

Fixes https://github.com/flutter/samples/issues/2746

## Pre-launch Checklist

- [x] I read the [Flutter Style Guide] recently, and have followed its
advice.
- [x] I signed the [CLA].
- [ ] I have added sample code updates to the [changelog].
- [ ] I updated/added relevant documentation (doc comments with `///`).

<!-- Links -->
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md
[CLA]: https://cla.developers.google.com/
[changelog]: ./CHANGELOG.md

Co-authored-by: Eric Windmill <eric@ericwindmill.com>
2026-06-19 14:43:13 -07:00
Abdulrahman Bashir
effe13307c Migrate testing_app to UIScene lifecycle (#2836)
## Summary
[![talabat.com
contributions](https://img.shields.io/badge/talabat.com-contributions-FF5A00?style=flat&logo=flutter&logoColor=white)](https://www.talabat.com)
[![Talabat Flutter
PRs](https://img.shields.io/badge/Talabat_Flutter_PRs-26%20merged-97ca00?style=flat&logo=flutter&logoColor=white)](https://github.com/search?q=org%3Aflutter+talabat&type=pullrequests)

- Migrate `testing_app` iOS project to the UIScene lifecycle as per the
[migration
guide](https://docs.flutter.dev/release/breaking-changes/uiscenedelegate)
- Update `AppDelegate.swift` to use `@main`,
`FlutterImplicitEngineDelegate`, and move plugin registration to
`didInitializeImplicitFlutterEngine`
- Add `UIApplicationSceneManifest` to `Info.plist`

Part of flutter/flutter#176957

## Test plan
- [x] Ran `testing_app` on iOS simulator — app launches and works
correctly

---------

Co-authored-by: Eric Windmill <eric@ericwindmill.com>
2026-06-19 14:35:48 -07:00
Harsh Yadav
8bfffd4a84 docs: clarify HomeViewModel lifecycle in Compass sample (#2838)
Adds a comment explaining why `HomeViewModel` is not disposed in the
Compass sample.

This clarifies that the current implementation is safe because the
ViewModel does not manage disposable resources. It also highlights that
in real applications, proper lifecycle management is required when
working with streams, controllers, or subscriptions.

Fixes https://github.com/flutter/samples/issues/2788

## Pre-launch Checklist

* [x] I read the [[Flutter Style
Guide](https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md)]
recently, and have followed its advice.
* [x] I signed the [[CLA](https://cla.developers.google.com/)].
* [ ] I have added sample code updates to the
[[changelog](https://chatgpt.com/c/CHANGELOG.md)].
* [x] I updated/added relevant documentation (doc comments with `///`).

<!-- Links -->

[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md
[CLA]: https://cla.developers.google.com/
[changelog]: ./CHANGELOG.md

---------

Co-authored-by: Eric Windmill <eric@ericwindmill.com>
2026-06-19 14:16:31 -07:00
Eric Windmill
f755c81579 Fix image loading error (#2865)
*Replace this paragraph with a description of what this PR is changing
or adding, and why. Consider including before/after screenshots.*

*List which issues are fixed by this PR. For larger changes, raising an
issue first helps
reduce redundant work.*

## Pre-launch Checklist

- [ ] I read the [Flutter Style Guide] _recently_, and have followed its
advice.
- [ ] I signed the [CLA].
- [ ] I read the [Contributors Guide].
- [ ] I have added sample code updates to the [changelog].
- [ ] I updated/added relevant documentation (doc comments with `///`).


If you need help, consider asking for advice on the #hackers-devrel
channel on [Discord].

<!-- Links -->
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md
[CLA]: https://cla.developers.google.com/
[Discord]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md
[Contributors Guide]:
https://github.com/flutter/samples/blob/main/CONTRIBUTING.md
[changelog]: ../CHANGELOG.md

---------

Co-authored-by: NiazSagor <niazsagor@gmail.com>
Co-authored-by: Niaz Sagor <50655067+NiazSagor@users.noreply.github.com>
2026-06-19 14:14:31 -07:00
Niaz Sagor
8da6d98439 Show placeholder for broken activity images (#2769)
Hello, I noticed that there are several image URLs that fail to load on
the Activities screen of the compass_app. The image shows the default
error widget right now.
This PR proposes to display a placeholder with a "broken image" icon
instead of the default error widget. This provides better visual
feedback to the user.

Current:
<img width="354" height="275" alt="image"
src="https://github.com/user-attachments/assets/3688e1a0-c36d-40ef-9474-001e3576d55a"
/>

After fix:
<img width="354" height="275" alt="image"
src="https://github.com/user-attachments/assets/0f853596-6b9c-4b82-b646-8a3cf01c6ad0"
/>

@ericwindmill, please take a look and see if it is appropriate.

## Pre-launch Checklist

- [x] I read the [Flutter Style Guide] _recently_, and have followed its
advice.
- [x] I signed the [CLA].
- [x] I read the [Contributors Guide].
- [x] I have added sample code updates to the [changelog].
- [x] I updated/added relevant documentation (doc comments with `///`).


<!-- Links -->
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md
[CLA]: https://cla.developers.google.com/
[Discord]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md
[Contributors Guide]:
https://github.com/flutter/samples/blob/main/CONTRIBUTING.md
[changelog]: ../CHANGELOG.md

Co-authored-by: Eric Windmill <eric@ericwindmill.com>
2026-06-19 14:13:45 -07:00
Mozammal Hossain
5f4c795695 [compass_app] Scope LogoutViewModel to route builder — fix #2604 (#2819)
## Description

**Problem:** `LogoutViewModel` was built inside `HomeHeader.build()`, so
each rebuild could create a new instance and a new `logout` command.
That does not match how other Compass view models are scoped (created in
the GoRouter route `builder` and passed in), and it can affect an
in-flight logout when the home screen rebuilds.

**Change:** Create `LogoutViewModel` once in the `/home` route next to
`HomeViewModel`, pass it through `HomeScreen` → `HomeHeader` →
`LogoutButton`, and remove inline construction in `home_title.dart`.
Update `home_screen_test.dart` to build `LogoutViewModel` with fakes and
remove `Provider` wrappers that only supported `context.read()` in the
header.

**Result:** Logout view model lifetime aligns with the home route; no
visual or copy changes (screenshots not needed).

Fixes https://github.com/flutter/samples/issues/2604

---

## Pre-launch Checklist

- [x] I read the [Flutter Style Guide] _recently_, and have followed its
advice.
- [x] I signed the [CLA].
- [x] I read the [Contributors Guide].
- [x] I have added sample code updates to the [changelog].
- [x] I updated/added relevant documentation (doc comments with `///`).

If you need help, consider asking for advice on the #hackers-devrel
channel on [Discord].

<!-- Links -->
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md
[CLA]: https://cla.developers.google.com/
[Discord]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md
[Contributors Guide]:
https://github.com/flutter/samples/blob/main/CONTRIBUTING.md
[changelog]: ../CHANGELOG.md

---------

Co-authored-by: Eric Windmill <eric@ericwindmill.com>
2026-06-19 14:11:27 -07:00
Masum Billah Sanjid
6957e4ad04 Dispose email and password controllers in the login screen (#2741)
This PR ensures proper disposal of the TextEditingController instances
for the email and password fields in the login screen to prevent memory
leaks.


## Pre-launch Checklist

- [x] I read the [Flutter Style Guide] _recently_, and have followed its
advice.
- [x] I signed the [CLA].
- [x] I read the [Contributors Guide].
- [x] I have added sample code updates to the [changelog].
- [x] I updated/added relevant documentation (doc comments with `///`).

Co-authored-by: Eric Windmill <eric@ericwindmill.com>
2026-04-15 09:19:57 -07:00
weasdown
c4b4adc16a docs: fix typo in compass_app BookingSummary class doc (#2786)
Fixes a [typo] in the [`compass_app`] sample's [`booking_summary.dart`].
The class doc for the `BookingSummary` class had "activities" written as
"activitities".


[`compass_app`]:
https://github.com/flutter/samples/tree/main/compass_app
[`booking_summary.dart`]:
https://github.com/flutter/samples/blob/main/compass_app/app/lib/domain/models/booking/booking_summary.dart
[typo]:
7abc7b91f2/compass_app/app/lib/domain/models/booking/booking_summary.dart (L12C10-L12C22)

Fixes #2785 .
2026-01-27 14:21:37 +08:00
Eric Windmill
2999d738b8 Dart 3.9 / Flutter 3.35 [first LLM release] (#2714)
I got carried away with Gemini and basically rewrote CI and the release
process for the new LLM reality. This work was largely completed by
Gemini.

- Bump all SDK versions to the current beta (3.9.0-0)
- Run `flutter channel beta`
- Wrote `ci_script.dart` to replace the bash scripts
- Converted repository to pub workspace #2499 
- Added llm.md and release.md
- Added redirect for deprecated Samples Index

## Pre-launch Checklist

- [x] I read the [Flutter Style Guide] _recently_, and have followed its
advice.
- [x] I signed the [CLA].
- [x] I read the [Contributors Guide].
- [x] I have added sample code updates to the [changelog].
- [x] I updated/added relevant documentation (doc comments with `///`).
2025-08-14 12:26:24 -07:00
Manaf Halimeh
0aa5415d5e [compass_app] fixing pixel overflowed (#2669)
*- use SingleChildScrollView in the auth screen to fix pixel
overflowed.*


![after](https://github.com/user-attachments/assets/4e346892-0260-443f-aa34-4fa3e3a57a42)

![before](https://github.com/user-attachments/assets/27484520-9342-4084-a83c-8dec43f02434)

*Fix for: https://github.com/flutter/samples/issues/2668.*

## Pre-launch Checklist

- [x] I read the [Flutter Style Guide] _recently_, and have followed its
advice.
- [x] I signed the [CLA].
- [x] I read the [Contributors Guide].
- [x] I have added sample code updates to the [changelog].
- [x] I updated/added relevant documentation (doc comments with `///`).


If you need help, consider asking for advice on the #hackers-devrel
channel on [Discord].

<!-- Links -->
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md
[CLA]: https://cla.developers.google.com/
[Discord]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md
[Contributors Guide]:
https://github.com/flutter/samples/blob/main/CONTRIBUTING.md
[changelog]: ../CHANGELOG.md
2025-08-08 11:23:34 -04:00
Sangam Shrestha
04aea26b6a remove useMaterial3 (#2579)
This PR removes redundant `useMaterial3` since it is true by default.

Fixes https://github.com/flutter/flutter/issues/162818

If you need help, consider asking for advice on the #hackers-devrel channel on [Discord].
2025-02-13 03:33:57 +00:00
Kevin Moore
9fef1332f3 Clean up dependencies across packages (#2585)
Drop dep on pkg:collection, use new bits in Dart 3.0
Fixed very old dep in navigation_and_routing – bug was fixed long ago
2025-02-13 03:14:20 +00:00
Eric Windmill
719fd72c38 Flutter 3.29 beta (#2571) 2025-02-12 18:08:01 -05:00
Parker Lougheed
e39638ebff Enable some extra lints for compass app client (#2560)
Enable a few more lints that were mostly followed already for
consistency.
2025-01-06 08:58:52 -05:00
Eric Windmill
f25adf4529 Flutter3.27 (#2483)
Updating samples for the next stable release
2024-12-11 14:34:29 -05:00
Miguel Beltran
57ecb5f7ba refactor Result class, remove asOk and asError (#2542)
As discussed in the PR for the Result pattern implementation
(https://github.com/flutter/website/pull/11444) @parlough recommended
that `asError` and `asOk` should be not be used, and instead we should
use proper exhaustiveness checking.

This PR removes the two "convenience" methods and refactors code.

In some cases, it was enough with writing a proper `if` clause, while in
others it was necessary to use a `switch`.

Still, they are present in the `testing` folder, as they can be useful
for testing purposes.

## Pre-launch Checklist

- [x] I read the [Flutter Style Guide] _recently_, and have followed its
advice.
- [x] I signed the [CLA].
- [x] I read the [Contributors Guide].
- [x] I have added sample code updates to the [changelog].
- [x] I updated/added relevant documentation (doc comments with `///`).

If you need help, consider asking for advice on the #hackers-devrel
channel on [Discord].

<!-- Links -->
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md
[CLA]: https://cla.developers.google.com/
[Discord]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md
[Contributors Guide]:
https://github.com/flutter/samples/blob/main/CONTRIBUTING.md
[changelog]: ../CHANGELOG.md
2024-12-05 13:16:04 -05:00
Parker Lougheed
5adcda3640 [compass_app] Don't expose Dimens subclasses (#2541)
Avoid exposing the subclasses as they shouldn't be instantiated again or
overridden.

Also consistently use fields and getters in the declarations.
2024-12-05 08:39:35 -05:00
Parker Lougheed
90cd385ef4 [compass_app] Mark classes used for namespacing as abstract final (#2540)
As they are just used for namespacing static properties, these classes
shouldn't be extended, implemented, or instantiated.
2024-12-05 08:39:19 -05:00
Parker Lougheed
c3c93a82f5 [compass_app] Standardize on Result factories rather than constructors (#2538)
From my review of the recipes PR in
https://github.com/flutter/website/pull/11444#pullrequestreview-2480423811.
2024-12-05 08:38:14 -05:00
Eric Windmill
46b5a26b26 Compass app (#2446) 2024-09-28 08:49:27 +10:00