Add url strategy support

This commit is contained in:
Moe Poi ~ 2022-05-14 22:41:17 +07:00
parent a7c3ea5922
commit e6ec1a13ef
4 changed files with 12 additions and 2 deletions

View file

@ -4,11 +4,12 @@ import 'package:page_transition/page_transition.dart';
import 'package:animated_splash_screen/animated_splash_screen.dart';
import 'package:nekoya_flutter/components/menu.dart';
import 'package:nekoya_flutter/utils/url_strategy.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
.then((_) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]).then((_) {
usePathUrlStrategy();
runApp(const Nekoya());
});
}

View file

@ -0,0 +1 @@
export 'url_strategy_noop.dart' if (dart.library.html) 'url_strategy_web.dart';

View file

@ -0,0 +1,3 @@
void usePathUrlStrategy() {
// noop
}

View file

@ -0,0 +1,5 @@
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
void usePathUrlStrategy() {
setUrlStrategy(PathUrlStrategy());
}