All checks were successful
gestemps/comptaplanapp/pipeline/head This commit looks good
50 lines
1.6 KiB
Dart
50 lines
1.6 KiB
Dart
import 'package:comptaplan_app/winbooks_migration_widget.dart';
|
|
import 'package:comptaplan_app/webview_widget.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
void main() {
|
|
const title = String.fromEnvironment("APP_TITLE");
|
|
const uri = String.fromEnvironment("APP_URI");
|
|
const playStoreUri = 'https://play.google.com/store/apps/details?id=com.winbooks.connect';
|
|
const appStoreUri = 'https://apps.apple.com/be/app/winbooks-connect/id1534550954';
|
|
const color = String.fromEnvironment("APP_COLOR");
|
|
runApp(const MyApp(title, uri, playStoreUri, appStoreUri, color));
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
final String _title;
|
|
final String _uri;
|
|
final String _playstoreUri;
|
|
final String _appStoreUri;
|
|
final String _color;
|
|
|
|
const MyApp(this._title, this._uri, this._playstoreUri, this._appStoreUri, this._color, {Key? key}) : super(key: key);
|
|
|
|
// This widget is the root of your application.
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
MaterialColor materialColor = _getMaterialColor(_color);
|
|
return MaterialApp(title: _title, theme: ThemeData(primarySwatch: materialColor), initialRoute: '/migrate', routes: {
|
|
'/migrate': (context) => WinbooksMigrationWidget(_title, _playstoreUri, _appStoreUri),
|
|
'/web': (context) => WebViewWidget(_uri),
|
|
});
|
|
}
|
|
|
|
MaterialColor _getMaterialColor(String colorString) {
|
|
switch (colorString) {
|
|
case "blue":
|
|
return Colors.blue;
|
|
case "red":
|
|
return Colors.red;
|
|
case "green":
|
|
return Colors.green;
|
|
case "yellow":
|
|
return Colors.yellow;
|
|
case "teal":
|
|
return Colors.teal;
|
|
default:
|
|
return Colors.blue;
|
|
}
|
|
}
|
|
}
|