redesign add account and add instance pages

This commit is contained in:
krawieck 2020-09-19 23:19:49 +02:00
parent f27ebf0da9
commit 6f94679eed
3 changed files with 136 additions and 63 deletions

View File

@ -1,10 +1,11 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:lemmur/hooks/stores.dart';
import 'package:lemmur/pages/add_instance.dart';
import 'package:url_launcher/url_launcher.dart' as ul;
import '../hooks/stores.dart';
import '../widgets/bottom_modal.dart';
import 'add_instance.dart';
class AddAccountPage extends HookWidget {
final String instanceUrl;
@ -87,10 +88,32 @@ class AddAccountPage extends HookWidget {
actionsIconTheme: theme.iconTheme,
iconTheme: theme.iconTheme,
textTheme: theme.textTheme,
brightness: theme.brightness,
centerTitle: true,
title: Text('Add account'),
backgroundColor: theme.canvasColor,
shadowColor: Colors.transparent,
),
bottomNavigationBar: BottomAppBar(
color: Colors.transparent,
elevation: 0,
child: SafeArea(
child: Row(
children: [
Padding(
padding: const EdgeInsets.all(15),
child: FlatButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
child: Text('Cancel'),
onPressed: () => Navigator.of(context).pop(),
),
),
],
),
),
),
body: Padding(
padding: const EdgeInsets.all(15),
child: ListView(
@ -113,52 +136,65 @@ class AddAccountPage extends HookWidget {
autofocus: true,
controller: usernameController,
decoration: InputDecoration(
isDense: true,
contentPadding:
EdgeInsets.symmetric(horizontal: 10, vertical: 10),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(13),
borderRadius: BorderRadius.circular(10),
),
labelText: 'Username or email',
),
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(10),
// ),
),
const SizedBox(height: 5),
TextField(
controller: passwordController,
obscureText: true,
decoration: InputDecoration(
isDense: true,
contentPadding:
EdgeInsets.symmetric(horizontal: 10, vertical: 10),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(13),
borderRadius: BorderRadius.circular(10),
),
labelText: 'Password',
),
),
Row(
// mainAxisAlignment: MainAxisAlignment.end,
children: [
FlatButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
child: Text('Cancel'),
onPressed: () => Navigator.of(context).pop(),
),
Spacer(),
RaisedButton(
color: theme.accentColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
child: !loading.value
? Text('Add')
: CircularProgressIndicator(),
onPressed: usernameController.text.isEmpty ||
passwordController.text.isEmpty
? null
: handleOnAdd,
),
],
)
RaisedButton(
color: theme.accentColor,
padding: EdgeInsets.all(0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
child: !loading.value
? Text('Sign in')
: CircularProgressIndicator(),
onPressed: usernameController.text.isEmpty ||
passwordController.text.isEmpty
? null
: handleOnAdd,
),
FlatButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
child: Text('Register'),
onPressed: () {
ul.launch('https://$instanceUrl/login');
},
),
// Row(
// // mainAxisAlignment: MainAxisAlignment.end,
// children: [
// FlatButton(
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(10),
// ),
// child: Text('Cancel'),
// onPressed: () => Navigator.of(context).pop(),
// ),
// Spacer(),
// ],
// )
],
),
),

View File

@ -31,48 +31,82 @@ class AddInstancePage extends HookWidget {
return Scaffold(
appBar: AppBar(
backgroundColor: theme.scaffoldBackgroundColor,
brightness: theme.brightness,
shadowColor: Colors.transparent,
iconTheme: theme.iconTheme,
centerTitle: true,
leading: CloseButton(),
actionsIconTheme: theme.iconTheme,
textTheme: theme.textTheme,
title: Text('Add instance'),
),
body: Padding(
padding: const EdgeInsets.all(15),
child: ListView(
children: [
if (false)
CachedNetworkImage(height: 150, width: 150)
else
SizedBox(height: 150),
TextField(
autofocus: true,
controller: instanceController,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'instance url',
),
),
Row(
children: <Widget>[
FlatButton(
bottomNavigationBar: BottomAppBar(
color: Colors.transparent,
elevation: 0,
child: SafeArea(
child: Row(
children: [
Padding(
padding: const EdgeInsets.all(15),
child: FlatButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
child: Text('Cancel'),
onPressed: () => Navigator.of(context).pop(),
),
Spacer(),
RaisedButton(
child: !loading.value
? Text('Add')
: CircularProgressIndicator(),
onPressed:
instanceController.text.isEmpty ? null : handleOnAdd,
),
],
)
],
),
],
),
),
),
body: ListView(
children: [
if (false)
CachedNetworkImage(height: 150, width: 150)
else
SizedBox(height: 150),
SizedBox(
height: 40,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 15),
child: TextField(
autofocus: true,
controller: instanceController,
decoration: InputDecoration(
isDense: true,
// contentPadding:
// EdgeInsets.symmetric(horizontal: 10, vertical: 12),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
),
labelText: 'instance url',
),
),
),
),
SizedBox(height: 5),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 15),
child: SizedBox(
height: 40,
child: RaisedButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
child:
!loading.value ? Text('Add') : CircularProgressIndicator(),
onPressed: instanceController.text.isEmpty ? null : handleOnAdd,
),
),
),
// Row(
// children: <Widget>[
// Spacer(),
// ],
// )
],
),
);
}
}

View File

@ -15,6 +15,7 @@ class SettingsPage extends StatelessWidget {
return Scaffold(
appBar: AppBar(
brightness: theme.brightness,
backgroundColor: theme.scaffoldBackgroundColor,
shadowColor: Colors.transparent,
iconTheme: theme.iconTheme,
@ -53,6 +54,7 @@ class AppearanceConfigPage extends HookWidget {
return Scaffold(
appBar: AppBar(
brightness: theme.brightness,
backgroundColor: theme.scaffoldBackgroundColor,
shadowColor: Colors.transparent,
iconTheme: theme.iconTheme,
@ -120,6 +122,7 @@ class AccountsConfigPage extends HookWidget {
key: _scaffoldKey,
appBar: AppBar(
backgroundColor: theme.scaffoldBackgroundColor,
brightness: theme.brightness,
shadowColor: Colors.transparent,
iconTheme: theme.iconTheme,
title: Text('Accounts', style: theme.textTheme.headline6),