From f62d1fcf6ecdf2a61ac6f4cceebf41b986a9873b Mon Sep 17 00:00:00 2001 From: Nishant Srivastava Date: Mon, 17 Aug 2026 16:02:18 +0200 Subject: [PATCH] docs: regenerate examples list and drop obsolete svn instructions - EXAMPLES.md now lists all 54 apps; generated by scripts/generate_examples_doc.sh so it cannot drift again - Replace dead 'svn checkout' instructions in GETTING_STARTED.md (GitHub removed SVN support) with git sparse-checkout --- documentation/EXAMPLES.md | 53 +++++++++++------- documentation/GETTING_STARTED.md | 33 +++++++----- scripts/generate_examples_doc.sh | 92 ++++++++++++++++++++++++++++++++ 3 files changed, 144 insertions(+), 34 deletions(-) create mode 100755 scripts/generate_examples_doc.sh diff --git a/documentation/EXAMPLES.md b/documentation/EXAMPLES.md index 002b80e..b3d1a45 100644 --- a/documentation/EXAMPLES.md +++ b/documentation/EXAMPLES.md @@ -4,39 +4,51 @@ 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. [Analytics Integration](/analytics_integration) +1. [Animation Example](/animation_example) +1. [Biometrics](/biometrics) +1. [Bottom Sheet](/bottom_sheet) +1. [Custom Home Drawer](/custom_home_drawer) +1. [Dropdown Button](/dropdown_button) +1. [Enabling Splash Screen](/enabling_splash_screen) +1. [Firebase Crash Reporting](/firebase_crash_reporting) +1. [Firebase Google Authentication](/firebase_google_authentication) +1. [GetX Counter App](/getx_counter_app) 1. [Google Signin](/google_signin) 1. [Grid Layout](/grid_layout) +1. [Handling Routes](/handling_routes) 1. [Image Editor](/image_editor) -1. [Image from Network](/image_from_network) +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. [Load Local Image](/load_local_image) +1. [Load Local JSON](/load_local_json) +1. [Lunch App](/lunch_app) 1. [Navigation Drawer](/navigation_drawer) +1. [News Memes App](/news_memes_app) 1. [Persist Key Value](/persist_key_value) 1. [Push Notifications](/push_notifications) +1. [Save Data Locally With SQLite](/save_data_locally_with_sqlite) +1. [Scan QR Code](/scan_qr_code) 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. [Stateless Counter App](/statless_counter_app) +1. [Tic Tac Toe](/tic_tac_toe) +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 Bottom Nav Bar](/using_bottom_nav_bar) 1. [Using Custom Fonts](/using_custom_fonts) -1. [Using EditText](/using_edittext) +1. [Using Edittext](/using_edittext) +1. [Using Expansionpanel](/using_expansionpanel) 1. [Using Gradient](/using_gradient) -1. [Using HTTP GET](/using_http_get) -1. [Using InteractiveViewer](/using_interactiveviewer) +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 ListWheelScrollView](/using_listwheelscrollview) +1. [Using Platform Adaptive](/using_platform_adaptive) +1. [Using Snackbar](/using_snackbar) 1. [Using Stepper](/using_stepper) 1. [Using Tabs](/using_tabs) 1. [Using Theme](/using_theme) @@ -44,8 +56,9 @@ Each folder in this repository is a standalone Flutter example app. ## Complete apps with multiple features -1. [Covid-19 App](/covid19_mobile_app) -1. [BMI Calculator](/bmi_calculator) +1. [Covid19 Mobile App](/covid19_mobile_app) +1. [Bmi Calculator](/bmi_calculator) 1. [Expense Planner](/expense_planner) -1. [Notes App](/using_firebase_db) +1. [Using Firebase Db](/using_firebase_db) 1. [Tip Calculator](/tip_calculator) + diff --git a/documentation/GETTING_STARTED.md b/documentation/GETTING_STARTED.md index 56ca725..2de314f 100644 --- a/documentation/GETTING_STARTED.md +++ b/documentation/GETTING_STARTED.md @@ -37,19 +37,24 @@ flutter run ## Download a single example -The repository is large. If you only want one example, use `svn`: +The repository is large. If you only want one example, use git sparse-checkout: -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 - ``` +```bash +git clone --no-checkout https://github.com/nisrulz/flutter-examples.git +cd flutter-examples +git sparse-checkout init --cone +git sparse-checkout set +git checkout +``` -That's it. You now have the single example checked out. +Example: + +```bash +git clone --no-checkout https://github.com/nisrulz/flutter-examples.git +cd flutter-examples +git sparse-checkout init --cone +git sparse-checkout set simple_material_app +git checkout +``` + +You now have the single example checked out. diff --git a/scripts/generate_examples_doc.sh b/scripts/generate_examples_doc.sh new file mode 100755 index 0000000..35c5f06 --- /dev/null +++ b/scripts/generate_examples_doc.sh @@ -0,0 +1,92 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Regenerates documentation/EXAMPLES.md from the example app folders on disk. +# Run via `make docs` after adding or removing an example app. + +source "$(dirname "${BASH_SOURCE[0]}")/common.sh" + +OUT="documentation/EXAMPLES.md" + +# Apps that demonstrate multiple features and are listed separately. +COMPLETE_APPS=( + covid19_mobile_app + bmi_calculator + expense_planner + using_firebase_db + tip_calculator +) + +# Folder -> display title overrides for non-obvious names. +declare -A TITLES=( + [statless_counter_app]="Stateless Counter App" + [sliver_app_bar_example]="Sliver App Bar" + [using_listwheelscrollview]="Using ListWheelScrollView" +) + +title_from_folder() { + local folder="$1" + if [ -n "${TITLES[$folder]:-}" ]; then + echo "${TITLES[$folder]}" + return + fi + local words + words=$(echo "$folder" | tr '_' ' ') + local out="" + for w in $words; do + case "$w" in + sqlite) w="SQLite" ;; + json) w="JSON" ;; + http) w="HTTP" ;; + pdf) w="PDF" ;; + qr) w="QR" ;; + getx) w="GetX" ;; + esac + out="$out ${w^}" + done + echo "${out# }" +} + +is_complete_app() { + local folder="$1" + local candidate + for candidate in "${COMPLETE_APPS[@]}"; do + [ "$candidate" = "$folder" ] && return 0 + done + return 1 +} + +apps=() +for dir in ./*; do + if [ -f "$dir/pubspec.yaml" ]; then + apps+=("$(basename "$dir")") + fi +done +IFS=$'\n' apps=($(sort <<<"${apps[*]}")); unset IFS + +{ + echo "# Example Apps" + echo "" + echo "Each folder in this repository is a standalone Flutter example app." + echo "" + echo "## Individual examples" + echo "" + local_apps=() + for app in "${apps[@]}"; do + if ! is_complete_app "$app"; then + local_apps+=("$app") + fi + done + for app in "${local_apps[@]}"; do + echo "1. [$(title_from_folder "$app")](/$app)" + done + echo "" + echo "## Complete apps with multiple features" + echo "" + for app in "${COMPLETE_APPS[@]}"; do + echo "1. [$(title_from_folder "$app")](/$app)" + done + echo "" +} > "$OUT" + +echo " Regenerated $OUT with ${#apps[@]} apps." \ No newline at end of file