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/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:lemmur/hooks/stores.dart'; import 'package:url_launcher/url_launcher.dart' as ul;
import 'package:lemmur/pages/add_instance.dart';
import '../hooks/stores.dart';
import '../widgets/bottom_modal.dart'; import '../widgets/bottom_modal.dart';
import 'add_instance.dart';
class AddAccountPage extends HookWidget { class AddAccountPage extends HookWidget {
final String instanceUrl; final String instanceUrl;
@ -87,10 +88,32 @@ class AddAccountPage extends HookWidget {
actionsIconTheme: theme.iconTheme, actionsIconTheme: theme.iconTheme,
iconTheme: theme.iconTheme, iconTheme: theme.iconTheme,
textTheme: theme.textTheme, textTheme: theme.textTheme,
brightness: theme.brightness,
centerTitle: true,
title: Text('Add account'), title: Text('Add account'),
backgroundColor: theme.canvasColor, backgroundColor: theme.canvasColor,
shadowColor: Colors.transparent, 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( body: Padding(
padding: const EdgeInsets.all(15), padding: const EdgeInsets.all(15),
child: ListView( child: ListView(
@ -113,52 +136,65 @@ class AddAccountPage extends HookWidget {
autofocus: true, autofocus: true,
controller: usernameController, controller: usernameController,
decoration: InputDecoration( decoration: InputDecoration(
isDense: true,
contentPadding:
EdgeInsets.symmetric(horizontal: 10, vertical: 10),
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: BorderRadius.circular(13), borderRadius: BorderRadius.circular(10),
), ),
labelText: 'Username or email', labelText: 'Username or email',
), ),
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(10),
// ),
), ),
const SizedBox(height: 5), const SizedBox(height: 5),
TextField( TextField(
controller: passwordController, controller: passwordController,
obscureText: true, obscureText: true,
decoration: InputDecoration( decoration: InputDecoration(
isDense: true,
contentPadding:
EdgeInsets.symmetric(horizontal: 10, vertical: 10),
border: OutlineInputBorder( border: OutlineInputBorder(
borderRadius: BorderRadius.circular(13), borderRadius: BorderRadius.circular(10),
), ),
labelText: 'Password', labelText: 'Password',
), ),
), ),
Row( RaisedButton(
// mainAxisAlignment: MainAxisAlignment.end, color: theme.accentColor,
children: [ padding: EdgeInsets.all(0),
FlatButton( shape: RoundedRectangleBorder(
shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10),
borderRadius: BorderRadius.circular(10), ),
), child: !loading.value
child: Text('Cancel'), ? Text('Sign in')
onPressed: () => Navigator.of(context).pop(), : CircularProgressIndicator(),
), onPressed: usernameController.text.isEmpty ||
Spacer(), passwordController.text.isEmpty
RaisedButton( ? null
color: theme.accentColor, : handleOnAdd,
shape: RoundedRectangleBorder( ),
borderRadius: BorderRadius.circular(10), FlatButton(
), shape: RoundedRectangleBorder(
child: !loading.value borderRadius: BorderRadius.circular(10),
? Text('Add') ),
: CircularProgressIndicator(), child: Text('Register'),
onPressed: usernameController.text.isEmpty || onPressed: () {
passwordController.text.isEmpty ul.launch('https://$instanceUrl/login');
? null },
: handleOnAdd, ),
), // 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( return Scaffold(
appBar: AppBar( appBar: AppBar(
backgroundColor: theme.scaffoldBackgroundColor, backgroundColor: theme.scaffoldBackgroundColor,
brightness: theme.brightness,
shadowColor: Colors.transparent, shadowColor: Colors.transparent,
iconTheme: theme.iconTheme, iconTheme: theme.iconTheme,
centerTitle: true,
leading: CloseButton(), leading: CloseButton(),
actionsIconTheme: theme.iconTheme, actionsIconTheme: theme.iconTheme,
textTheme: theme.textTheme, textTheme: theme.textTheme,
title: Text('Add instance'), title: Text('Add instance'),
), ),
body: Padding( bottomNavigationBar: BottomAppBar(
padding: const EdgeInsets.all(15), color: Colors.transparent,
child: ListView( elevation: 0,
children: [ child: SafeArea(
if (false) child: Row(
CachedNetworkImage(height: 150, width: 150) children: [
else Padding(
SizedBox(height: 150), padding: const EdgeInsets.all(15),
TextField( child: FlatButton(
autofocus: true, shape: RoundedRectangleBorder(
controller: instanceController, borderRadius: BorderRadius.circular(10),
decoration: InputDecoration( ),
border: OutlineInputBorder(),
labelText: 'instance url',
),
),
Row(
children: <Widget>[
FlatButton(
child: Text('Cancel'), child: Text('Cancel'),
onPressed: () => Navigator.of(context).pop(), 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( return Scaffold(
appBar: AppBar( appBar: AppBar(
brightness: theme.brightness,
backgroundColor: theme.scaffoldBackgroundColor, backgroundColor: theme.scaffoldBackgroundColor,
shadowColor: Colors.transparent, shadowColor: Colors.transparent,
iconTheme: theme.iconTheme, iconTheme: theme.iconTheme,
@ -53,6 +54,7 @@ class AppearanceConfigPage extends HookWidget {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
brightness: theme.brightness,
backgroundColor: theme.scaffoldBackgroundColor, backgroundColor: theme.scaffoldBackgroundColor,
shadowColor: Colors.transparent, shadowColor: Colors.transparent,
iconTheme: theme.iconTheme, iconTheme: theme.iconTheme,
@ -120,6 +122,7 @@ class AccountsConfigPage extends HookWidget {
key: _scaffoldKey, key: _scaffoldKey,
appBar: AppBar( appBar: AppBar(
backgroundColor: theme.scaffoldBackgroundColor, backgroundColor: theme.scaffoldBackgroundColor,
brightness: theme.brightness,
shadowColor: Colors.transparent, shadowColor: Colors.transparent,
iconTheme: theme.iconTheme, iconTheme: theme.iconTheme,
title: Text('Accounts', style: theme.textTheme.headline6), title: Text('Accounts', style: theme.textTheme.headline6),