Skip to content

Commit 6518bbb

Browse files
authored
Update web template (#4)
* feat: Update Flutter App intro animation to fadeIn only * feat: Update web templates to use CustomRoutes * Corrects broken main template for web
1 parent a8f69c0 commit 6518bbb

File tree

8 files changed

+13
-26
lines changed

8 files changed

+13
-26
lines changed

lib/src/services/analytics_service.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class AnalyticsService {
3434
await _analytics.waitForLastPing(
3535
timeout: const Duration(milliseconds: 200),
3636
);
37-
_analytics.close();
3837
}
3938

4039
/// Sends create app command event

lib/src/services/config_service.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ class ConfigService {
244244
path.split('/').where((element) => !element.contains('.'));
245245

246246
for (var i = 0; i < pathSegments.length; i++) {
247-
fileToImport = '../' + fileToImport;
247+
fileToImport = '../$fileToImport';
248248
}
249249

250250
return fileToImport;

lib/src/templates/app/web/lib/app/app.dart.stk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import 'package:stacked_services/stacked_services.dart';
88

99
@StackedApp(
1010
routes: [
11-
MaterialRoute(page: StartupView, initial: true),
12-
MaterialRoute(page: HomeView),
11+
CustomRoute(page: StartupView, initial: true),
12+
CustomRoute(page: HomeView),
1313
// @stacked-route
1414
],
1515
dependencies: [

lib/src/templates/app/web/lib/main.dart.stk

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,10 @@ class MyApp extends StatelessWidget {
3636
routerDelegate: stackedRouter.delegate(),
3737
routeInformationParser: stackedRouter.defaultRouteParser(),
3838
).animate()
39-
.moveY(end: 0, begin: 35)
4039
.fadeIn(
41-
duration: const Duration(milliseconds: 500),
4240
delay: const Duration(milliseconds: 50),
41+
duration: const Duration(milliseconds: 400),
4342
)
44-
.scale(
45-
begin: const Offset(0.9, 0.9),
46-
end: const Offset(1, 1),
47-
curve: Curves.easeInOut,
48-
),
4943
);
5044
}
5145
}

lib/src/templates/compiled_template_map.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ Map<String, Map<String, StackedTemplate>> kCompiledStackedTemplates = {
347347
ModificationFile(
348348
relativeModificationPath: 'lib/app/app.dart',
349349
modificationIdentifier: '// @stacked-route',
350-
modificationTemplate: '''MaterialRoute(page: {{viewName}}),''',
350+
modificationTemplate: '''CustomRoute(page: {{viewName}}),''',
351351
modificationProblemError:
352352
'The structure of your stacked application is invalid. The app.dart file should be located in lib/app/',
353353
modificationName:

lib/src/templates/compiled_templates.dart

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -497,16 +497,10 @@ class MyApp extends StatelessWidget {
497497
routerDelegate: stackedRouter.delegate(),
498498
routeInformationParser: stackedRouter.defaultRouteParser(),
499499
).animate()
500-
.moveY(end: 0, begin: 35)
501500
.fadeIn(
502-
duration: const Duration(milliseconds: 500),
503501
delay: const Duration(milliseconds: 50),
502+
duration: const Duration(milliseconds: 400),
504503
)
505-
.scale(
506-
begin: const Offset(0.9, 0.9),
507-
end: const Offset(1, 1),
508-
curve: Curves.easeInOut,
509-
),
510504
);
511505
}
512506
}
@@ -1435,8 +1429,8 @@ import 'package:stacked_services/stacked_services.dart';
14351429
14361430
@StackedApp(
14371431
routes: [
1438-
MaterialRoute(page: StartupView, initial: true),
1439-
MaterialRoute(page: HomeView),
1432+
CustomRoute(page: StartupView, initial: true),
1433+
CustomRoute(page: HomeView),
14401434
// @stacked-route
14411435
],
14421436
dependencies: [

lib/src/templates/view/web/modifications/add_route.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"description": "When a view is generated one of the boilerplate tasks is to add a route to the app.dart file for the new view. To get the file in that view we need to import it. This action adds that file import",
33
"path": "lib/app/app.dart",
44
"identifier": "// @stacked-route",
5-
"template": "MaterialRoute(page: {{viewName}}),",
5+
"template": "CustomRoute(page: {{viewName}}),",
66
"error": "The structure of your stacked application is invalid. The app.dart file should be located in lib/app/",
77
"name": "Add {{viewName}} route where @StackedApp annotation is located"
88
}

test/services/process_service_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ void main() {
1414
group('runFormat -', () {
1515
test('when called should run flutter format . and finish in exit code 0',
1616
() async {
17-
var _clog = getAndRegisterColorizedLogService();
17+
var clog = getAndRegisterColorizedLogService();
1818
var service = _getService();
1919
await service.runFormat();
20-
verify(_clog.success(message: 'Command complete. ExitCode: 0'));
20+
verify(clog.success(message: 'Command complete. ExitCode: 0'));
2121
});
2222

2323
test(
2424
'when called should run flutter format . and ouput error if appName is not found',
2525
() async {
26-
var _clog = getAndRegisterColorizedLogService();
26+
var clog = getAndRegisterColorizedLogService();
2727
var service = _getService();
2828
await service.runFormat(appName: "xyz");
29-
verify(_clog.error(message: anyNamed('message')));
29+
verify(clog.error(message: anyNamed('message')));
3030
});
3131
});
3232
});

0 commit comments

Comments
 (0)