Skip to content

Commit

Permalink
Merge pull request #99 from nimblehq/release/1.0.0
Browse files Browse the repository at this point in the history
[CHORE] Release 1.0.0
  • Loading branch information
manh-t authored Jul 15, 2022
2 parents c8fa734 + 22aa887 commit d53a8d3
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .template/integration_test/my_home_page_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void main() {

testWidgets('My Home Page widget', (WidgetTester tester) async {
await tester
.pumpWidget(TestUtil.pumpWidgetWithShellApp(const MyHomePage()));
.pumpWidget(TestUtil.pumpWidgetWithShellApp(const HomeScreen()));
await tester.pumpAndSettle();

expect(find.widgetWithText(AppBar, 'Flutter templates testing'),
Expand Down
2 changes: 1 addition & 1 deletion .template/integration_test/utils/test_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class TestUtil {
/// localization, routes, etc)
static Widget pumpWidgetWithRealApp(String initialRoute) {
_initDependencies();
return MyApp(initialRoute: initialRoute);
return MyApp();
}

/// We normally use this function to test a specific [widget] without
Expand Down
61 changes: 49 additions & 12 deletions .template/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,57 @@ import 'package:flutter/material.dart';
import 'package:flutter_config/flutter_config.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_templates/gen/assets.gen.dart';
import 'package:go_router/go_router.dart';
import 'package:package_info_plus/package_info_plus.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
await FlutterConfig.loadEnvVariables();
runApp(const MyApp());
runApp(MyApp());
}

const routePathRootScreen = '/';
const routePathSecondScreen = 'second';

class MyApp extends StatelessWidget {
// TODO: implement Routes then remove `home: MyHomePage()` and use initialRoute instead.
final String initialRoute;
MyApp({Key? key}) : super(key: key);

const MyApp({
Key? key,
this.initialRoute = '/',
}) : super(key: key);
final GoRouter _router = GoRouter(
routes: <GoRoute>[
GoRoute(
path: routePathRootScreen,
builder: (BuildContext context, GoRouterState state) =>
const HomeScreen(),
routes: [
GoRoute(
path: routePathSecondScreen,
builder: (BuildContext context, GoRouterState state) =>
const SecondScreen(),
),
],
),
],
);

@override
Widget build(BuildContext context) {
return MaterialApp(
return MaterialApp.router(
theme: ThemeData(
primarySwatch: Colors.blue,
brightness: Brightness.light,
fontFamily: Assets.fonts.neuzeit,
),
home: const MyHomePage(),
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
routeInformationProvider: _router.routeInformationProvider,
routeInformationParser: _router.routeInformationParser,
routerDelegate: _router.routerDelegate,
);
}
}

class MyHomePage extends StatelessWidget {
const MyHomePage({Key? key}) : super(key: key);
class HomeScreen extends StatelessWidget {
const HomeScreen({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -65,10 +82,30 @@ class MyHomePage extends StatelessWidget {
Text(
FlutterConfig.get('SECRET'),
style: const TextStyle(color: Colors.black, fontSize: 24),
)
),
const SizedBox(height: 24),
ElevatedButton(
onPressed: () => context.go('/$routePathSecondScreen'),
child: const Text("Navigate to Second Screen"),
),
],
),
),
);
}
}

class SecondScreen extends StatelessWidget {
const SecondScreen({
Key? key,
}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Second Screen"),
),
);
}
}
65 changes: 36 additions & 29 deletions .template/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ packages:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.6"
version: "3.1.11"
args:
dependency: transitive
description:
Expand Down Expand Up @@ -63,7 +63,7 @@ packages:
name: build_daemon
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
version: "3.1.0"
build_resolvers:
dependency: transitive
description:
Expand All @@ -77,7 +77,7 @@ packages:
name: build_runner
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.7"
version: "2.1.11"
build_runner_core:
dependency: transitive
description:
Expand Down Expand Up @@ -140,7 +140,7 @@ packages:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
version: "1.16.0"
color:
dependency: transitive
description:
Expand Down Expand Up @@ -168,7 +168,7 @@ packages:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
version: "1.0.5"
dart_style:
dependency: transitive
description:
Expand All @@ -189,14 +189,14 @@ packages:
name: dio
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.4"
version: "4.0.6"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.0"
ffi:
dependency: transitive
description:
Expand Down Expand Up @@ -241,21 +241,21 @@ packages:
name: flutter_gen_core
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.6"
version: "4.3.0"
flutter_gen_runner:
dependency: "direct dev"
description:
name: flutter_gen_runner
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.6"
version: "4.3.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
version: "2.0.1"
flutter_localizations:
dependency: "direct main"
description: flutter
Expand All @@ -277,14 +277,14 @@ packages:
name: freezed
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
version: "2.0.3+1"
freezed_annotation:
dependency: "direct main"
description:
name: freezed_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "2.0.3"
frontend_server_client:
dependency: transitive
description:
Expand All @@ -304,6 +304,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
go_router:
dependency: "direct main"
description:
name: go_router
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
graphs:
dependency: transitive
description:
Expand Down Expand Up @@ -357,28 +364,28 @@ packages:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
version: "0.6.4"
json_annotation:
dependency: "direct main"
description:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "4.4.0"
version: "4.5.0"
json_serializable:
dependency: "direct dev"
description:
name: json_serializable
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.5"
version: "6.2.0"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "2.0.0"
logging:
dependency: transitive
description:
Expand All @@ -399,7 +406,7 @@ packages:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
version: "0.1.4"
meta:
dependency: transitive
description:
Expand All @@ -420,7 +427,7 @@ packages:
name: mockito
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.0"
version: "5.2.0"
package_config:
dependency: transitive
description:
Expand All @@ -434,14 +441,14 @@ packages:
name: package_info_plus
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.0"
version: "1.4.2"
package_info_plus_linux:
dependency: transitive
description:
name: package_info_plus_linux
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
version: "1.0.5"
package_info_plus_macos:
dependency: transitive
description:
Expand All @@ -462,21 +469,21 @@ packages:
name: package_info_plus_web
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
version: "1.0.5"
package_info_plus_windows:
dependency: transitive
description:
name: package_info_plus_windows
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
version: "1.0.5"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.8.1"
petitparser:
dependency: transitive
description:
Expand Down Expand Up @@ -586,7 +593,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -635,7 +642,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.8"
version: "0.4.9"
time:
dependency: transitive
description:
Expand Down Expand Up @@ -670,14 +677,14 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
version: "2.1.2"
vm_service:
dependency: transitive
description:
name: vm_service
url: "https://pub.dartlang.org"
source: hosted
version: "7.5.0"
version: "8.2.2"
watcher:
dependency: transitive
description:
Expand Down Expand Up @@ -721,5 +728,5 @@ packages:
source: hosted
version: "3.1.0"
sdks:
dart: ">=2.16.1 <3.0.0"
flutter: ">=1.20.0"
dart: ">=2.17.5 <3.0.0"
flutter: ">=3.0.0"
Loading

0 comments on commit d53a8d3

Please sign in to comment.