Skip to content
Snippets Groups Projects

Mobile app initial implementation.

Merged Igor Markin requested to merge 3-android-mobile-app-web-view into master
1 file
+ 66
9
Compare changes
  • Side-by-side
  • Inline
+ 66
9
@@ -17,7 +17,30 @@ class Home extends StatefulWidget {
_HomeState createState() => _HomeState();
}
const hosts = [
'https://rosengeorgiev.dev.vereign.com',
'https://borisdimitrov.dev.vereign.com',
'https://app.vereign.com',
'https://integration.vereign.com',
'https://staging.vereign.com',
'https://demo1.vereign.com',
'https://demo2.vereign.com',
'https://damyanmitev.dev.vereign.com',
'https://gospodinbodurov.dev.vereign.com',
'https://alexeylunin.dev.vereign.com',
'https://igormarkin.dev.vereign.com',
'https://mikhaildorokhovich.dev.vereign.com',
'https://sashailieva.dev.vereign.com',
'https://alexanderholodov.dev.vereign.com',
'https://olguncengiz.dev.vereign.com',
'https://viktorpopov.dev.vereign.com',
'https://kalincanov.dev.vereign.com',
'https://alexeykuklin.dev.vereign.com'
];
class _HomeState extends State<Home> {
String _host = Config.appFlavor == Flavor.DEVELOPMENT ? hosts[0] : APP_HOST;
@override
initState() {
super.initState();
@@ -77,7 +100,7 @@ class _HomeState extends State<Home> {
}
openVereign() {
FlutterWebBrowser.openWebPage(url: APP_HOST, androidToolbarColor: Color(0xFFd51d32));
FlutterWebBrowser.openWebPage(url: _host, androidToolbarColor: Color(0xFFd51d32));
}
startOAuth() {
@@ -100,29 +123,63 @@ class _HomeState extends State<Home> {
}
@override
Widget build(BuildContext context) {
var children = <Widget>[
_urlButton(context, "Open Dashboard", openVereign),
_urlButton(context, "Authorize with Vereign", startOAuth)
];
if (Config.appFlavor == Flavor.DEVELOPMENT) {
children.add(
wrapInContainer(
DropdownButton<String>(
value: _host,
onChanged: (String newValue) {
setState(() {
_host = newValue;
});
},
items: hosts
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
})
.toList(),
)
)
);
}
return Scaffold(
body: SafeArea(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
_urlButton(context, "Open Dashboard", openVereign),
_urlButton(context, "Authorize with Vereign", startOAuth),
]
children: children
))));
}
Widget _urlButton(BuildContext context, String title, listener) {
Widget wrapInContainer(Widget widget) {
return Container(
padding: EdgeInsets.all(20.0),
child: FlatButton(
padding: EdgeInsets.all(20.0),
child: widget,
);
}
Widget _urlButton(BuildContext context, String title, listener) {
return wrapInContainer(
FlatButton(
color: Theme.of(context).primaryColor,
textColor: Colors.white,
padding: const EdgeInsets.symmetric(horizontal: 50.0, vertical: 15.0),
child: Text(title),
onPressed: listener
));
)
);
}
}
\ No newline at end of file
Loading