From 074e61fab8823b624cc67e5ed280e36c894ec03e Mon Sep 17 00:00:00 2001 From: Daniel Borges Date: Wed, 7 Aug 2019 15:55:02 -0300 Subject: [PATCH] settings screen layout --- lib/src/widgets/settings.dart | 63 ++++++++++++++++++++++++++++++++--- pubspec.yaml | 5 +-- 2 files changed, 59 insertions(+), 9 deletions(-) diff --git a/lib/src/widgets/settings.dart b/lib/src/widgets/settings.dart index 2c472f6..c1bc615 100644 --- a/lib/src/widgets/settings.dart +++ b/lib/src/widgets/settings.dart @@ -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 { ListTile( title: Text('Server IP'), subtitle: Text(serverIp), - onTap: () {}, + onTap: () { + showDialog( + context: context, + builder: (context) => _InputDialog('Type the IP'), + ); + }, ), ListTile( title: Text('Server port'), subtitle: Text('$serverPort'), - onTap: () {}, + onTap: () { + showDialog( + context: context, + builder: (context) => _InputDialog('Type the port'), + ); + }, ), CheckboxListTile( title: Text('Use HTTPS'), @@ -65,21 +77,62 @@ class _SettingState extends State { enabled: needsAuth, title: Text('User ID'), subtitle: Text(userId), - onTap: () {}, + onTap: () { + showDialog( + context: context, + builder: (context) => _InputDialog('Type the username'), + ); + }, ), ListTile( enabled: needsAuth, title: Text('User password'), subtitle: Text(userPassword), - onTap: () {}, + onTap: () { + showDialog( + 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: [ + FlatButton( + child: Text('CANCEL'), + onPressed: () { + Navigator.pop(context); + }, + ), + FlatButton( + child: Text('OK'), + onPressed: () { + Navigator.pop(context, ''); + }, + ), + ], + ); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 25bf8b9..c143e00 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: