1
0
mirror of https://github.com/nisrulz/flutter-examples.git synced 2026-08-25 01:05:36 +00:00

chore: modernize Flutter examples — null safety, latest APIs, Kotlin DSL Gradle (#148)

* updates

* Update Gradle wrapper script to fetch latest version online and allow --version override

* chore(analytics_integration): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build files to Kotlin DSL and bump Gradle wrapper.

* chore(animation_example): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build files to Kotlin DSL.

* chore(biometrics): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build files to Kotlin DSL.

* chore(bmi_calculator): test

test body

* chore(bottom_sheet): test

test body

* chore(custom_home_drawer): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build files to Kotlin DSL and bump Gradle wrapper.

* chore(covid19_mobile_app): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(dropdown_button): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(enabling_splash_screen): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(expense_planner): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(firebase_crash_reporting): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(firebase_google_authentication): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(flutter_date_pickers-master): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(getx_counter_app): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(google_signin): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(grid_layout): remove legacy nested android project

Delete the redundant nested android/ project directory from the old layout. Also update pubspec.yaml SDK constraints and dependencies.

* chore(handling_routes): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(image_editor): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(image_from_network): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(infinite_list): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(load_local_image): remove legacy nested android project

Delete the redundant nested android/ project directory from the old layout. Also update pubspec.yaml SDK constraints and dependencies.

* chore(load_local_json): remove legacy nested android project

Delete the redundant nested android/ project directory from the old layout. Also update pubspec.yaml SDK constraints and dependencies.

* chore(lunch_app): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(navigation_drawer): remove legacy nested android project

Delete the redundant nested android/ project directory from the old layout. Also update pubspec.yaml SDK constraints and dependencies.

* chore(news_memes_app): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(persist_key_value): remove legacy nested android project

Delete the redundant nested android/ project directory from the old layout. Also update pubspec.yaml SDK constraints and dependencies.

* chore(push_notifications): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(save_data_locally_with_sqlite): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(scan_qr_code): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(simple_material_app): remove legacy nested android project

Delete the redundant nested android/ project directory from the old layout. Also update pubspec.yaml SDK constraints and dependencies.

* chore(sliver_app_bar_example): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(stateful_widget): remove legacy nested android project

Delete the redundant nested android/ project directory from the old layout. Also update pubspec.yaml SDK constraints and dependencies.

* chore(stateless_widgets): remove legacy nested android project

Delete the redundant nested android/ project directory from the old layout. Also update pubspec.yaml SDK constraints and dependencies.

* chore(statless_counter_app): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(tic_tac_toe): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(tip_calculator): remove legacy nested android project

Delete the redundant nested android/ project directory from the old layout. Also update pubspec.yaml SDK constraints and dependencies.

* chore(todo_list_using_provider): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(unit_testing): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(using_alert_dialog): remove legacy nested android project

Delete the redundant nested android/ project directory from the old layout. Also update pubspec.yaml SDK constraints and dependencies.

* chore(using_bottom_nav_bar): remove legacy nested android project

Delete the redundant nested android/ project directory from the old layout. Also update pubspec.yaml SDK constraints and dependencies.

* chore(using_custom_fonts): remove legacy nested android project

Delete the redundant nested android/ project directory from the old layout. Also update pubspec.yaml SDK constraints and dependencies.

* chore(using_edittext): remove legacy nested android project

Delete the redundant nested android/ project directory from the old layout. Also update pubspec.yaml SDK constraints and dependencies.

* chore(using_expansionpanel): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(using_firebase_db): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(using_gradient): remove legacy nested android project

Delete the redundant nested android/ project directory from the old layout. Also update pubspec.yaml SDK constraints and dependencies.

* chore(using_http_get): remove legacy nested android project

Delete the redundant nested android/ project directory from the old layout. Also update pubspec.yaml SDK constraints and dependencies.

* chore(using_interactiveviewer): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(using_listview): remove legacy nested android project

Delete the redundant nested android/ project directory from the old layout. Also update pubspec.yaml SDK constraints and dependencies.

* chore(using_listwheelscrollview): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(using_platform_adaptive): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore(using_snackbar): remove legacy nested android project

Delete the redundant nested android/ project directory from the old layout. Also update pubspec.yaml SDK constraints and dependencies.

* chore(using_stepper): remove legacy nested android project

Delete the redundant nested android/ project directory from the old layout. Also update pubspec.yaml SDK constraints and dependencies.

* chore(using_tabs): remove legacy nested android project

Delete the redundant nested android/ project directory from the old layout. Also update pubspec.yaml SDK constraints and dependencies.

* chore(using_theme): remove legacy nested android project

Delete the redundant nested android/ project directory from the old layout. Also update pubspec.yaml SDK constraints and dependencies.

* chore(view_pdf_file): migrate Gradle build scripts to Kotlin DSL

Convert Groovy build.gradle/settings.gradle to Kotlin DSL and bump Gradle wrapper.

* chore: ignore .trash directory

* chore: remove IDE configs and PR template

* chore(infinite_list): remove legacy nested android project

* refactor(infinite_list): migrate theme to ColorScheme API

* refactor(using_theme): migrate to ColorScheme API

* refactor(analytics_integration): migrate Firebase Analytics API

* refactor(firebase_google_authentication): migrate Google Sign-In API

* refactor(covid19_mobile_app): migrate theme and buttons to current API

* refactor(covid19_mobile_app): replace bezier_chart with fl_chart

* refactor(image_editor): migrate image plugins and button styles

* refactor(scan_qr_code): migrate mobile_scanner API

* refactor(lunch_app): migrate to null safety

* refactor(todo_list_using_provider): migrate to null safety

* refactor(unit_testing): migrate to null safety

* refactor(using_firebase_db): migrate Firebase Database API

* fix(update_gradle_wrapper): edit gradle-wrapper.properties directly

* refactor(push_notifications): migrate Firebase Messaging API

* refactor(using_http_get): migrate to null safety

* refactor(using_listview): migrate to null safety

* refactor(using_listwheelscrollview): migrate to null safety

* refactor(view_pdf_file): migrate to null safety

* refactor(bottom_sheet): migrate to null safety

* refactor(stateless_widgets): migrate to null safety

* chore: regenerate Gradle wrapper

* refactor: move maintenance scripts to Makefile

* chore: remove generated and IDE files

* fix: migrate image_editor to current plugins

* fix: migrate news_memes_app share to share_plus

* fix: migrate view_pdf_file to syncfusion pdf viewer

* fix: update deprecated APIs

* style: remove commented-out code
This commit is contained in:
Nishant Srivastava
2026-08-17 13:58:51 +02:00
committed by GitHub
parent 80fe9bed92
commit 8745f7cf5a
2600 changed files with 9278 additions and 58100 deletions

View File

@@ -0,0 +1,13 @@
# Contributing
I welcome and encourage all pull requests. It usually takes 24-48 hours to respond to any issue or request.
## Basic rules
1. Match coding style (braces, spacing, etc.). Use the `Reformat Code` feature of Android Studio (`CMD` + `Option` + `L` on Mac, `CTRL` + `ALT` + `L` on Linux and Windows).
1. For a feature or bugfix, only change the code that is needed for it.
1. Keep pull request titles easy to read and descriptive. This makes them easier to merge.
1. Pull requests must be made against the `develop` branch. Requests against any other branch will be rejected. [Here is a link to a good PR made to this repo.](https://github.com/nisrulz/flutter-examples/pull/130)
1. Check for existing [issues](https://github.com/nisrulz/flutter-examples/issues) before filing a new one.
1. Follow the same standard as all other projects in this repo.
> The package name must conform to the format: `github.nisrulz.<app_name>`

51
documentation/EXAMPLES.md Normal file
View File

@@ -0,0 +1,51 @@
# Example Apps
Each folder in this repository is a standalone Flutter example app.
## Individual examples
1. [Custom Drawer](/custom_home_drawer)
1. [DropDown Button](/dropdown_button)
1. [Enable Splash Screen](/enabling_splash_screen)
1. [Firebase Analytics Integration](/analytics_integration)
1. [Firebase Crashlytics Integration](/firebase_crash_reporting)
1. [Google Signin](/google_signin)
1. [Grid Layout](/grid_layout)
1. [Image Editor](/image_editor)
1. [Image from Network](/image_from_network)
1. [Infinite List](/infinite_list)
1. [Load local image](/load_local_image)
1. [Load local json](/load_local_json)
1. [Navigation Drawer](/navigation_drawer)
1. [Persist Key Value](/persist_key_value)
1. [Push Notifications](/push_notifications)
1. [Simple Material App](/simple_material_app)
1. [Sliver App Bar](/sliver_app_bar_example)
1. [Stateful Widget](/stateful_widget)
1. [Stateless counter app](/statless_counter_app)
1. [Stateless Widgets](/stateless_widgets)
1. [Todo list using Provider](/todo_list_using_provider)
1. [Unit Testing](/unit_testing)
1. [Using Alert Dialog](/using_alert_dialog)
1. [Using Bottom Navigation Bar](/using_bottom_nav_bar)
1. [Using Bottom Sheet](/bottom_sheet)
1. [Using Custom Fonts](/using_custom_fonts)
1. [Using EditText](/using_edittext)
1. [Using Gradient](/using_gradient)
1. [Using HTTP GET](/using_http_get)
1. [Using InteractiveViewer](/using_interactiveviewer)
1. [Using Listview](/using_listview)
1. [Using ListwheelScrollView](/using_listwheelscrollview)
1. [Using SnackBar](/using_snackbar)
1. [Using Stepper](/using_stepper)
1. [Using Tabs](/using_tabs)
1. [Using Theme](/using_theme)
1. [View PDF File](/view_pdf_file)
## Complete apps with multiple features
1. [Covid-19 App](/covid19_mobile_app)
1. [BMI Calculator](/bmi_calculator)
1. [Expense Planner](/expense_planner)
1. [Notes App](/using_firebase_db)
1. [Tip Calculator](/tip_calculator)

View File

@@ -0,0 +1,55 @@
# Getting Started
## Prerequisites
Install Flutter. See the [official setup guide](https://flutter.dev/setup/).
You also need an editor. See the [Flutter docs](https://flutter.dev/docs/get-started/editor) for setup.
## Run an example app
Clone this repository and install packages:
```bash
git clone https://github.com/nisrulz/flutter-examples.git
cd flutter-examples
make packages
```
Open any example folder in your editor, then run the app on a device or emulator:
```bash
cd <example-folder>
flutter run
```
For example:
```bash
cd simple_material_app
flutter run
```
## Useful links
- [Flutter Widgets Catalog](https://flutter.dev/widgets/)
- [Learn Dart](https://dart.dev/guides)
## Download a single example
The repository is large. If you only want one example, use `svn`:
1. Install `svn` (macOS / Linux):
```bash
brew install svn
```
2. Replace `example_folder` in the command below with the example folder name:
```bash
svn checkout https://github.com/nisrulz/flutter-examples/trunk/example_folder
```
3. Example:
```bash
svn checkout https://github.com/nisrulz/flutter-examples/trunk/simple_material_app
```
That's it. You now have the single example checked out.

View File

@@ -0,0 +1,35 @@
# Repository Maintenance
All maintenance commands are available through the `Makefile` at the repository root. Run `make help` to see the full list.
## Available commands
| Command | Description |
| --- | --- |
| `make help` | Show all available commands |
| `make packages` | Run `flutter packages get` for all example apps |
| `make clean-builds` | Move all build folders to trash |
| `make gradle-update` | Upgrade Gradle wrappers to the latest version |
## Update Gradle wrappers
`make gradle-update` upgrades the Gradle wrapper of every example app.
| Option | Description |
| --- | --- |
| `VERSION=<x.y.z>` | Target a specific Gradle version. Default: latest from GitHub |
| `FORCE=1` | Upgrade even when the app is already on the target version |
Examples:
```bash
make gradle-update # latest version
make gradle-update VERSION=9.7.0 # specific version
make gradle-update FORCE=1 # latest version, force update
make gradle-update VERSION=9.7.0 FORCE=1 # specific version, force update
```
## Requirements
- `make` (preinstalled on macOS and most Linux systems)
- `trash` (required by `make clean-builds`): `brew install trash`