├── .github └── workflows │ ├── checks.yml │ ├── greetings.yml │ ├── licenses.yml │ ├── pana.yml │ └── publish.yml ├── .gitignore ├── CODEOWNERS ├── LICENSE ├── README.md └── url_strategy ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── example ├── .gitignore ├── .metadata ├── README.md ├── lib │ └── main.dart ├── pubspec.lock ├── pubspec.yaml └── web │ ├── favicon.png │ ├── icons │ ├── Icon-192.png │ └── Icon-512.png │ ├── index.html │ └── manifest.json ├── lib ├── src │ ├── url_strategy_non_web.dart │ └── url_strategy_web.dart └── url_strategy.dart └── pubspec.yaml /.github/workflows/checks.yml: -------------------------------------------------------------------------------- 1 | name: Checks 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | paths: 8 | - '**/lib/**' 9 | - '**/android/**' 10 | - '**/ios/**' 11 | - '**/pubspec.yaml' 12 | - '**/test/**' 13 | - '**/test_driver/**' 14 | - '**/assets/**' 15 | - '**/integration_test/**' 16 | 17 | jobs: 18 | analyze: 19 | timeout-minutes: 7 20 | runs-on: ubuntu-latest 21 | name: Analysis of ${{ matrix.package }} (${{ matrix.channel }}) 22 | strategy: 23 | matrix: 24 | channel: 25 | - 'stable' 26 | - 'beta' 27 | - 'dev' 28 | package: 29 | - 'url_strategy' 30 | fail-fast: false 31 | 32 | steps: 33 | - uses: actions/checkout@v2.3.3 34 | - uses: subosito/flutter-action@v1.4.0 35 | with: 36 | channel: ${{ matrix.channel }} 37 | - run: flutter pub get 38 | working-directory: ${{ matrix.package }} 39 | - name: Check format 40 | working-directory: ${{ matrix.package }} 41 | run: dart format . --set-exit-if-changed 42 | - run: flutter analyze 43 | working-directory: ${{ matrix.package }} 44 | -------------------------------------------------------------------------------- /.github/workflows/greetings.yml: -------------------------------------------------------------------------------- 1 | name: greetings 2 | 3 | on: 4 | - pull_request_target 5 | - issues 6 | 7 | jobs: 8 | greeting: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/first-interaction@v1 12 | with: 13 | repo-token: ${{ secrets.GITHUB_TOKEN }} 14 | issue-message: | 15 | Hi 👋🏽 Thank you for opening your first issue with simpleclub/url_strategy ❤ 16 | 17 | You can expect triage from us soon 🙂 18 | In the meantime, you can try to search for similar issues in our [issue database]. 19 | 20 | [issue database]: https://github.com/simpleclub/url_strategy/issues?q=is%3Aissue 21 | pr-message: | 22 | Hi 👋🏽 Thank you for opening your first PR with simpleclub/url_strategy ❤ 23 | 24 | You can expect a review from us soon ☺️ 25 | In the meantime, please check our [contribution guidelines], the PR checklist, and the PR checks. 26 | 27 | [contribution guidelines]: https://github.com/simpleclub/url_strategy/blob/main/CONTRIBUTING.md 28 | -------------------------------------------------------------------------------- /.github/workflows/licenses.yml: -------------------------------------------------------------------------------- 1 | name: Licenses 2 | 3 | on: 4 | schedule: 5 | - cron: '0 0 1 1 *' 6 | workflow_dispatch: 7 | 8 | jobs: 9 | years: 10 | timeout-minutes: 11 11 | runs-on: ubuntu-latest 12 | name: Update copyright year(s) 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | with: 17 | fetch-depth: 0 18 | - uses: FantasticFiasco/action-update-license-year@v2 19 | with: 20 | token: ${{ secrets.GITHUB_TOKEN }} 21 | path: '**/LICENSE' 22 | commitTitle: Update copyright year in LICENSE file(s) 23 | commitAuthorName: simpleclub-bot 24 | commitAuthorEmail: developers@simpleclub.com 25 | prTitle: Update copyright year in LICENSE file(s) 26 | prBody: New Year is here and we want to keep up with time :) 27 | -------------------------------------------------------------------------------- /.github/workflows/pana.yml: -------------------------------------------------------------------------------- 1 | name: Pana 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | paths: 8 | - '**/lib/**' 9 | - '**/android/**' 10 | - '**/ios/**' 11 | - '**/pubspec.yaml' 12 | - '**/test/**' 13 | - '**/test_driver/**' 14 | - '**/assets/**' 15 | - '**/integration_test/**' 16 | 17 | jobs: 18 | configure: 19 | timeout-minutes: 9 20 | runs-on: ubuntu-latest 21 | name: Configuration of ${{ matrix.package }} 22 | strategy: 23 | matrix: 24 | package: 25 | - 'url_strategy' 26 | fail-fast: false 27 | 28 | steps: 29 | - uses: actions/checkout@v2.3.3 30 | - uses: axel-op/dart-package-analyzer@v3 31 | with: 32 | relativePath: ${{ matrix.package }} 33 | githubToken: ${{ secrets.GITHUB_TOKEN }} 34 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish to pub.dev 2 | 3 | on: 4 | push: 5 | tags: 6 | # Must align with the tag-pattern configured on pub.dev. 7 | - 'url_strategy-v[0-9]+.[0-9]+.[0-9]+*' 8 | 9 | jobs: 10 | pana: 11 | timeout-minutes: 9 12 | runs-on: ubuntu-latest 13 | name: Configuration of ${{ matrix.package }} 14 | strategy: 15 | matrix: 16 | package: 17 | - 'url_strategy' 18 | fail-fast: false 19 | 20 | steps: 21 | - uses: actions/checkout@v2.3.3 22 | - uses: axel-op/dart-package-analyzer@v3 23 | with: 24 | relativePath: ${{ matrix.package }} 25 | githubToken: ${{ secrets.GITHUB_TOKEN }} 26 | 27 | publish: 28 | needs: pana 29 | timeout-minutes: 4 30 | runs-on: ubuntu-latest 31 | name: Publishing of ${{ matrix.package }} 32 | permissions: 33 | id-token: write # Allows to publish to pub.dev without personal credentials 34 | strategy: 35 | matrix: 36 | package: 37 | - 'url_strategy' 38 | fail-fast: false 39 | 40 | steps: 41 | - uses: actions/checkout@v2.3.3 42 | with: 43 | fetch-depth: 2 44 | 45 | - uses: dart-lang/setup-dart@v1 46 | - uses: subosito/flutter-action@v2 47 | with: 48 | channel: 'stable' 49 | - run: flutter pub get 50 | working-directory: ${{ matrix.package }} 51 | - run: flutter pub publish --dry-run 52 | working-directory: ${{ matrix.package }} 53 | - run: flutter pub publish --force 54 | working-directory: ${{ matrix.package }} 55 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @creativecreatorormaybenot 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2021-2024, simpleclub 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # url_strategy [![Pub version](https://img.shields.io/pub/v/url_strategy.svg)](https://pub.dev/packages/url_strategy) 2 | 3 | > ⚠️ **Discontinued**: The functionality is now provided by the flutter SDK out of the box: 4 | > 5 | > https://docs.flutter.dev/ui/navigation/url-strategies 6 | 7 | Package for Flutter apps that allows setting the web URL strategy with a single line of code. 8 | 9 | ## Usage 10 | 11 | With a simple call of `setPathUrlStrategy`, your Flutter web app does not have a leading `#` 12 | in the URL anymore 🚀 13 | 14 | ```dart 15 | import 'package:url_strategy/url_strategy.dart'; 16 | 17 | void main() { 18 | // Here we set the URL strategy for our web app. 19 | // It is safe to call this function when running on mobile or desktop as well. 20 | setPathUrlStrategy(); 21 | runApp(MyApp()); 22 | } 23 | ``` 24 | 25 | See the [`url_strategy` package README](https://github.com/simpleclub/url_strategy/tree/master/url_strategy) 26 | or the [explanation on StackOverflow](https://stackoverflow.com/a/65709246/6509751) for more detailed usage documentation. 27 | 28 | ## Implementation 29 | 30 | The package is basically a wrapper around the [`flutter_web_plugins`](https://github.com/flutter/flutter/tree/master/packages/flutter_web_plugins) 31 | `setUrlStrategy`. The reason it exists is that using the function from `flutter_web_plugins` 32 | requires conditional imports. 33 | The problem is solved by using a conditional export from the `url_strategy` package. 34 | -------------------------------------------------------------------------------- /url_strategy/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | pubspec.lock 32 | build/ 33 | 34 | # Android related 35 | **/android/**/gradle-wrapper.jar 36 | **/android/.gradle 37 | **/android/captures/ 38 | **/android/gradlew 39 | **/android/gradlew.bat 40 | **/android/local.properties 41 | **/android/**/GeneratedPluginRegistrant.java 42 | 43 | # iOS/XCode related 44 | **/ios/**/*.mode1v3 45 | **/ios/**/*.mode2v3 46 | **/ios/**/*.moved-aside 47 | **/ios/**/*.pbxuser 48 | **/ios/**/*.perspectivev3 49 | **/ios/**/*sync/ 50 | **/ios/**/.sconsign.dblite 51 | **/ios/**/.tags* 52 | **/ios/**/.vagrant/ 53 | **/ios/**/DerivedData/ 54 | **/ios/**/Icon? 55 | **/ios/**/Pods/ 56 | **/ios/**/.symlinks/ 57 | **/ios/**/profile 58 | **/ios/**/xcuserdata 59 | **/ios/.generated/ 60 | **/ios/Flutter/App.framework 61 | **/ios/Flutter/Flutter.framework 62 | **/ios/Flutter/Flutter.podspec 63 | **/ios/Flutter/Generated.xcconfig 64 | **/ios/Flutter/app.flx 65 | **/ios/Flutter/app.zip 66 | **/ios/Flutter/flutter_assets/ 67 | **/ios/Flutter/flutter_export_environment.sh 68 | **/ios/ServiceDefinitions.json 69 | **/ios/Runner/GeneratedPluginRegistrant.* 70 | 71 | # Exceptions to above rules. 72 | !**/ios/**/default.mode1v3 73 | !**/ios/**/default.mode2v3 74 | !**/ios/**/default.pbxuser 75 | !**/ios/**/default.perspectivev3 76 | -------------------------------------------------------------------------------- /url_strategy/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: b9d06fffb2db263ab7021fc39adde7f2bf988a4a 8 | channel: dev 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /url_strategy/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.3.0 2 | 3 | * Migrated to js_interop. (#42) 4 | 5 | ## 0.2.0 6 | 7 | * Bumped to stable null safety release. 8 | 9 | ## 0.2.0-nullsafety.0 10 | 11 | * Migrated to NNBD. 12 | 13 | ## 0.1.1 14 | 15 | * Updated README and names. 16 | 17 | ## 0.1.0+1 18 | 19 | * Added link to more detailed explanation in README. 20 | 21 | ## 0.1.0 22 | 23 | * Initial release. 24 | -------------------------------------------------------------------------------- /url_strategy/LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2021-2024, simpleclub 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /url_strategy/README.md: -------------------------------------------------------------------------------- 1 | # url_strategy [![GitHub stars](https://img.shields.io/github/stars/simpleclub/url_strategy.svg)](https://github.com/simpleclub/url_strategy) 2 | 3 | Package for Flutter apps that allows setting the web URL strategy with a single line of code. 4 | 5 | ## Usage 6 | 7 | To use this plugin, follow the [installing guide](https://pub.dev/packages/url_strategy/install). 8 | 9 | ### Setting the URL strategy 10 | 11 | If you want to remove the leading hash (`#`) from the URL of your Flutter web app, you can simply 12 | call `setPathUrlStrategy` in the `main` function of your app: 13 | 14 | ```dart 15 | import 'package:url_strategy/url_strategy.dart'; 16 | 17 | void main() { 18 | // Here we set the URL strategy for our web app. 19 | // It is safe to call this function when running on mobile or desktop as well. 20 | setPathUrlStrategy(); 21 | runApp(MyApp()); 22 | } 23 | ``` 24 | 25 | Now, your Flutter web app will not have a leading `#` in the URL anymore. 26 | 27 | It is safe to call the function even when running on any other platform than web (which is the point 28 | of this package). That means that you can safely call `setPathUrlStrategy` when running on mobile 29 | or desktop - it will simply be a noop. 30 | 31 | #### Base 32 | 33 | Make sure that you have `` included inside the `` section of your 34 | `web/index.html` if you want to use the path URL strategy. 35 | This is included by default when you create a new Flutter project. 36 | 37 | Furthermore, you need to ensure that your production HTTP server always serves your `web/index.html` 38 | file for all paths. 39 | 40 | See [this more detailed StackOverflow answer][answer] for more information. 41 | 42 | #### Hash strategy 43 | 44 | You can also use a hash URL strategy instead (which is the default) by calling `setHashUrlStrategy`. 45 | 46 | [answer]: https://stackoverflow.com/a/65709246/6509751 47 | -------------------------------------------------------------------------------- /url_strategy/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /url_strategy/example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: b9d06fffb2db263ab7021fc39adde7f2bf988a4a 8 | channel: dev 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /url_strategy/example/README.md: -------------------------------------------------------------------------------- 1 | # url_strategy_example 2 | 3 | Example app for using the [`url_strategy` package](https://github.com/simpleclub/url_strategy/tree/main/url_strategy). 4 | -------------------------------------------------------------------------------- /url_strategy/example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:url_strategy/url_strategy.dart'; 3 | 4 | void main() { 5 | // Here we set the URL strategy for our web app. 6 | // It is safe to call this function when running on mobile or desktop as well. 7 | setPathUrlStrategy(); 8 | runApp(MyApp()); 9 | } 10 | 11 | /// The example `main.dart` file below contains an almost unmodified Flutter 12 | /// counter starter app that is generated with the app template. 13 | /// We only pass `example/path` as the initial route to demonstrate the URL 14 | /// strategy. 15 | 16 | class MyApp extends StatelessWidget { 17 | // This widget is the root of your application. 18 | @override 19 | Widget build(BuildContext context) { 20 | return MaterialApp( 21 | initialRoute: 'example/path', 22 | title: 'Flutter Demo', 23 | theme: ThemeData( 24 | // This is the theme of your application. 25 | // 26 | // Try running your application with "flutter run". You'll see the 27 | // application has a blue toolbar. Then, without quitting the app, try 28 | // changing the primarySwatch below to Colors.green and then invoke 29 | // "hot reload" (press "r" in the console where you ran "flutter run", 30 | // or simply save your changes to "hot reload" in a Flutter IDE). 31 | // Notice that the counter didn't reset back to zero; the application 32 | // is not restarted. 33 | primarySwatch: Colors.blue, 34 | ), 35 | routes: { 36 | 'example/path': (context) => 37 | MyHomePage(title: 'Flutter Demo Home Page w/ example path'), 38 | }, 39 | home: MyHomePage(title: 'Flutter Demo Home Page'), 40 | ); 41 | } 42 | } 43 | 44 | class MyHomePage extends StatefulWidget { 45 | MyHomePage({Key? key, required this.title}) : super(key: key); 46 | 47 | // This widget is the home page of your application. It is stateful, meaning 48 | // that it has a State object (defined below) that contains fields that affect 49 | // how it looks. 50 | 51 | // This class is the configuration for the state. It holds the values (in this 52 | // case the title) provided by the parent (in this case the App widget) and 53 | // used by the build method of the State. Fields in a Widget subclass are 54 | // always marked "final". 55 | 56 | final String title; 57 | 58 | @override 59 | _MyHomePageState createState() => _MyHomePageState(); 60 | } 61 | 62 | class _MyHomePageState extends State { 63 | int _counter = 0; 64 | 65 | void _incrementCounter() { 66 | setState(() { 67 | // This call to setState tells the Flutter framework that something has 68 | // changed in this State, which causes it to rerun the build method below 69 | // so that the display can reflect the updated values. If we changed 70 | // _counter without calling setState(), then the build method would not be 71 | // called again, and so nothing would appear to happen. 72 | _counter++; 73 | }); 74 | } 75 | 76 | @override 77 | Widget build(BuildContext context) { 78 | // This method is rerun every time setState is called, for instance as done 79 | // by the _incrementCounter method above. 80 | // 81 | // The Flutter framework has been optimized to make rerunning build methods 82 | // fast, so that you can just rebuild anything that needs updating rather 83 | // than having to individually change instances of widgets. 84 | return Scaffold( 85 | appBar: AppBar( 86 | // Here we take the value from the MyHomePage object that was created by 87 | // the App.build method, and use it to set our appbar title. 88 | title: Text(widget.title), 89 | ), 90 | body: Center( 91 | // Center is a layout widget. It takes a single child and positions it 92 | // in the middle of the parent. 93 | child: Column( 94 | // Column is also a layout widget. It takes a list of children and 95 | // arranges them vertically. By default, it sizes itself to fit its 96 | // children horizontally, and tries to be as tall as its parent. 97 | // 98 | // Invoke "debug painting" (press "p" in the console, choose the 99 | // "Toggle Debug Paint" action from the Flutter Inspector in Android 100 | // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) 101 | // to see the wireframe for each widget. 102 | // 103 | // Column has various properties to control how it sizes itself and 104 | // how it positions its children. Here we use mainAxisAlignment to 105 | // center the children vertically; the main axis here is the vertical 106 | // axis because Columns are vertical (the cross axis would be 107 | // horizontal). 108 | mainAxisAlignment: MainAxisAlignment.center, 109 | children: [ 110 | Text( 111 | 'You have pushed the button this many times:', 112 | ), 113 | Text( 114 | '$_counter', 115 | style: Theme.of(context).textTheme.headline4, 116 | ), 117 | ], 118 | ), 119 | ), 120 | floatingActionButton: FloatingActionButton( 121 | onPressed: _incrementCounter, 122 | tooltip: 'Increment', 123 | child: Icon(Icons.add), 124 | ), // This trailing comma makes auto-formatting nicer for build methods. 125 | ); 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /url_strategy/example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | characters: 5 | dependency: transitive 6 | description: 7 | name: characters 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "1.1.0" 11 | collection: 12 | dependency: transitive 13 | description: 14 | name: collection 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.15.0" 18 | flutter: 19 | dependency: "direct main" 20 | description: flutter 21 | source: sdk 22 | version: "0.0.0" 23 | flutter_web_plugins: 24 | dependency: transitive 25 | description: flutter 26 | source: sdk 27 | version: "0.0.0" 28 | js: 29 | dependency: transitive 30 | description: 31 | name: js 32 | url: "https://pub.dartlang.org" 33 | source: hosted 34 | version: "0.6.3" 35 | meta: 36 | dependency: transitive 37 | description: 38 | name: meta 39 | url: "https://pub.dartlang.org" 40 | source: hosted 41 | version: "1.3.0" 42 | sky_engine: 43 | dependency: transitive 44 | description: flutter 45 | source: sdk 46 | version: "0.0.99" 47 | typed_data: 48 | dependency: transitive 49 | description: 50 | name: typed_data 51 | url: "https://pub.dartlang.org" 52 | source: hosted 53 | version: "1.3.0" 54 | url_strategy: 55 | dependency: "direct main" 56 | description: 57 | path: ".." 58 | relative: true 59 | source: path 60 | version: "0.2.0" 61 | vector_math: 62 | dependency: transitive 63 | description: 64 | name: vector_math 65 | url: "https://pub.dartlang.org" 66 | source: hosted 67 | version: "2.1.0" 68 | sdks: 69 | dart: ">=2.12.0-259.9.beta <3.0.0" 70 | flutter: ">=1.20.0" 71 | -------------------------------------------------------------------------------- /url_strategy/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: url_strategy_example 2 | description: Example app for using the url_strategy package. 3 | publish_to: 'none' 4 | version: 1.0.0+1 5 | 6 | environment: 7 | sdk: '>=2.12.0-259.9.beta <3.0.0' 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | 13 | url_strategy: 14 | # When depending on this package from a real application you should use: 15 | # url_strategy: ^x.y.z 16 | # See https://dart.dev/tools/pub/dependencies#version-constraints 17 | # The example app is bundled with the package so we use a path dependency on 18 | # the parent directory to use the current package's version. 19 | path: ../ 20 | 21 | flutter: 22 | uses-material-design: true 23 | -------------------------------------------------------------------------------- /url_strategy/example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simpleclub/url_strategy/688383971b73a6b8a982617bfe81a7949518f5f0/url_strategy/example/web/favicon.png -------------------------------------------------------------------------------- /url_strategy/example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simpleclub/url_strategy/688383971b73a6b8a982617bfe81a7949518f5f0/url_strategy/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /url_strategy/example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simpleclub/url_strategy/688383971b73a6b8a982617bfe81a7949518f5f0/url_strategy/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /url_strategy/example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | url_strategy_example 30 | 31 | 32 | 33 | 36 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /url_strategy/example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "url_strategy_example", 3 | "short_name": "url_strategy_example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "Example app for using the url_strategy package.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /url_strategy/lib/src/url_strategy_non_web.dart: -------------------------------------------------------------------------------- 1 | /// Sets the URL strategy of your web app to using paths instead of a leading 2 | /// hash (`#`). 3 | /// 4 | /// You can safely call this on all platforms, i.e. also when running on mobile 5 | /// or desktop. In that case, it will simply be a noop. 6 | /// 7 | /// See also: 8 | /// * [setHashUrlStrategy], which will use a hash URL strategy instead. 9 | void setPathUrlStrategy() { 10 | // Noop. 11 | } 12 | 13 | /// Sets the URL strategy of your web app to using a leading has (`#`) instead 14 | /// of paths. 15 | /// 16 | /// You can safely call this on all platforms, i.e. also when running on mobile 17 | /// or desktop. In that case, it will simply be a noop. 18 | /// 19 | /// See also: 20 | /// * [setPathUrlStrategy], which will use a path URL strategy instead. 21 | void setHashUrlStrategy() { 22 | // Noop. 23 | } 24 | -------------------------------------------------------------------------------- /url_strategy/lib/src/url_strategy_web.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_web_plugins/flutter_web_plugins.dart'; 2 | 3 | /// Sets the URL strategy of your web app to using paths instead of a leading 4 | /// hash (`#`). 5 | /// 6 | /// You can safely call this on all platforms, i.e. also when running on mobile 7 | /// or desktop. In that case, it will simply be a noop. 8 | /// 9 | /// See also: 10 | /// * [setHashUrlStrategy], which will use a hash URL strategy instead. 11 | void setPathUrlStrategy() { 12 | setUrlStrategy(PathUrlStrategy()); 13 | } 14 | 15 | /// Sets the URL strategy of your web app to using a leading has (`#`) instead 16 | /// of paths. 17 | /// 18 | /// You can safely call this on all platforms, i.e. also when running on mobile 19 | /// or desktop. In that case, it will simply be a noop. 20 | /// 21 | /// See also: 22 | /// * [setPathUrlStrategy], which will use a path URL strategy instead. 23 | void setHashUrlStrategy() { 24 | setUrlStrategy(HashUrlStrategy()); 25 | } 26 | -------------------------------------------------------------------------------- /url_strategy/lib/url_strategy.dart: -------------------------------------------------------------------------------- 1 | export 'package:url_strategy/src/url_strategy_non_web.dart' 2 | if (dart.library.js_interop) 'package:url_strategy/src/url_strategy_web.dart'; 3 | -------------------------------------------------------------------------------- /url_strategy/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: url_strategy 2 | description: >-2 3 | Flutter package that allows setting the web app URL strategy with a single line of code. 4 | version: 0.3.0 5 | homepage: https://github.com/simpleclub/url_strategy/tree/main/url_strategy 6 | 7 | environment: 8 | sdk: '>=2.15.0 <4.0.0' 9 | flutter: '>=1.20.0' 10 | 11 | dependencies: 12 | flutter_web_plugins: 13 | sdk: flutter 14 | --------------------------------------------------------------------------------