settings screen layout

This commit is contained in:
Daniel Borges 2019-08-07 15:55:02 -03:00
parent dac62f2c35
commit 074e61fab8
2 changed files with 59 additions and 9 deletions

View File

@ -1,4 +1,6 @@
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
class Settings extends StatefulWidget {
@override
@ -35,12 +37,22 @@ class _SettingState extends State<Settings> {
ListTile(
title: Text('Server IP'),
subtitle: Text(serverIp),
onTap: () {},
onTap: () {
showDialog<String>(
context: context,
builder: (context) => _InputDialog('Type the IP'),
);
},
),
ListTile(
title: Text('Server port'),
subtitle: Text('$serverPort'),
onTap: () {},
onTap: () {
showDialog<String>(
context: context,
builder: (context) => _InputDialog('Type the port'),
);
},
),
CheckboxListTile(
title: Text('Use HTTPS'),
@ -65,21 +77,62 @@ class _SettingState extends State<Settings> {
enabled: needsAuth,
title: Text('User ID'),
subtitle: Text(userId),
onTap: () {},
onTap: () {
showDialog<String>(
context: context,
builder: (context) => _InputDialog('Type the username'),
);
},
),
ListTile(
enabled: needsAuth,
title: Text('User password'),
subtitle: Text(userPassword),
onTap: () {},
onTap: () {
showDialog<String>(
context: context,
builder: (context) => _InputDialog('Type the password'),
);
},
),
Divider(),
ListTile(
title: Text('About OpenLP'),
onTap: () {},
onTap: () {
launch('https://openlp.org/');
},
),
],
),
);
}
}
class _InputDialog extends StatelessWidget {
final String title;
_InputDialog(this.title);
@override
Widget build(BuildContext context) {
return AlertDialog(
title: Text(this.title),
contentPadding: EdgeInsets.all(15),
content: TextField(autofocus: true),
actions: <Widget>[
FlatButton(
child: Text('CANCEL'),
onPressed: () {
Navigator.pop(context);
},
),
FlatButton(
child: Text('OK'),
onPressed: () {
Navigator.pop(context, '');
},
),
],
);
}
}

View File

@ -19,10 +19,7 @@ environment:
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
url_launcher: ^5.1.2
dev_dependencies:
flutter_test: