name ui fix and removed parts of the app that are not ready
This commit is contained in:
@@ -70,16 +70,17 @@ class _DashboardPageState extends State<DashboardPage> {
|
||||
icon: Icons.person_add,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: AppSpacing.small),
|
||||
Expanded(
|
||||
flex: 0,
|
||||
child: TransactionRefButton(
|
||||
onTap: () => _setActive(false),
|
||||
isActive: _showContainerMultiple,
|
||||
label: l10n.sendMultiple,
|
||||
icon: Icons.group_add,
|
||||
),
|
||||
),
|
||||
//TODO bring back multiple payouts
|
||||
// const SizedBox(width: AppSpacing.small),
|
||||
// Expanded(
|
||||
// flex: 0,
|
||||
// child: TransactionRefButton(
|
||||
// onTap: () => _setActive(false),
|
||||
// isActive: _showContainerMultiple,
|
||||
// label: l10n.sendMultiple,
|
||||
// icon: Icons.group_add,
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: AppSpacing.medium),
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/providers/account_name.dart';
|
||||
|
||||
|
||||
class AccountNameEditingFields extends StatelessWidget {
|
||||
const AccountNameEditingFields({
|
||||
super.key,
|
||||
required this.hintText,
|
||||
required this.lastNameHint,
|
||||
required this.inputWidth,
|
||||
required this.borderWidth,
|
||||
required this.state,
|
||||
});
|
||||
|
||||
final String hintText;
|
||||
final String lastNameHint;
|
||||
final double inputWidth;
|
||||
final double borderWidth;
|
||||
final AccountNameState state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
return SizedBox(
|
||||
width: inputWidth,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextFormField(
|
||||
controller: state.firstNameController,
|
||||
style: theme.textTheme.headlineMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
autofocus: true,
|
||||
enabled: !state.isBusy,
|
||||
decoration: InputDecoration(
|
||||
hintText: hintText,
|
||||
labelText: hintText,
|
||||
isDense: true,
|
||||
border: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: theme.colorScheme.primary,
|
||||
width: borderWidth,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
TextFormField(
|
||||
controller: state.lastNameController,
|
||||
style: theme.textTheme.headlineSmall?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
enabled: !state.isBusy,
|
||||
decoration: InputDecoration(
|
||||
hintText: lastNameHint,
|
||||
labelText: lastNameHint,
|
||||
isDense: true,
|
||||
border: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: theme.colorScheme.primary,
|
||||
width: borderWidth,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
class AccountNameSingleLineText extends StatelessWidget {
|
||||
const AccountNameSingleLineText({
|
||||
super.key,
|
||||
required this.text,
|
||||
required this.style,
|
||||
});
|
||||
|
||||
final String text;
|
||||
final TextStyle? style;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Text(
|
||||
text,
|
||||
maxLines: 1,
|
||||
softWrap: false,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: style,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:pweb/pages/settings/profile/account/name/editing.dart';
|
||||
import 'package:pweb/pages/settings/profile/account/name/view.dart';
|
||||
import 'package:pweb/providers/account_name.dart';
|
||||
|
||||
|
||||
@@ -22,63 +24,22 @@ class AccountNameText extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final state = context.watch<AccountNameState>();
|
||||
final theme = Theme.of(context);
|
||||
|
||||
if (state.isEditing) {
|
||||
return SizedBox(
|
||||
width: inputWidth,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextFormField(
|
||||
controller: state.firstNameController,
|
||||
style: theme.textTheme.headlineMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
autofocus: true,
|
||||
enabled: !state.isBusy,
|
||||
decoration: InputDecoration(
|
||||
hintText: hintText,
|
||||
labelText: hintText,
|
||||
isDense: true,
|
||||
border: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: theme.colorScheme.primary,
|
||||
width: borderWidth,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
TextFormField(
|
||||
controller: state.lastNameController,
|
||||
style: theme.textTheme.headlineSmall?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
enabled: !state.isBusy,
|
||||
decoration: InputDecoration(
|
||||
hintText: lastNameHint,
|
||||
labelText: lastNameHint,
|
||||
isDense: true,
|
||||
border: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: theme.colorScheme.primary,
|
||||
width: borderWidth,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
return AccountNameEditingFields(
|
||||
hintText: hintText,
|
||||
lastNameHint: lastNameHint,
|
||||
borderWidth: borderWidth,
|
||||
inputWidth: inputWidth,
|
||||
state: state,
|
||||
);
|
||||
}
|
||||
|
||||
final displayName = state.currentFullName.isNotEmpty ? state.currentFullName : hintText;
|
||||
return Text(
|
||||
displayName,
|
||||
style: theme.textTheme.headlineMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
return AccountNameViewText(
|
||||
hintText: hintText,
|
||||
inputWidth: inputWidth,
|
||||
firstName: state.currentFirstName,
|
||||
lastName: state.currentLastName,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/pages/settings/profile/account/name/line.dart';
|
||||
|
||||
|
||||
class AccountNameViewText extends StatelessWidget {
|
||||
const AccountNameViewText({
|
||||
super.key,
|
||||
required this.hintText,
|
||||
required this.inputWidth,
|
||||
required this.firstName,
|
||||
required this.lastName,
|
||||
});
|
||||
|
||||
final String hintText;
|
||||
final double inputWidth;
|
||||
final String firstName;
|
||||
final String lastName;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final trimmedFirstName = firstName.trim();
|
||||
final trimmedLastName = lastName.trim();
|
||||
final hasFirstName = trimmedFirstName.isNotEmpty;
|
||||
final hasLastName = trimmedLastName.isNotEmpty;
|
||||
|
||||
final firstLineStyle = theme.textTheme.headlineMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
);
|
||||
final secondLineStyle = theme.textTheme.headlineMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
);
|
||||
|
||||
if (!hasFirstName && !hasLastName) {
|
||||
return SizedBox(
|
||||
width: inputWidth,
|
||||
child: AccountNameSingleLineText(
|
||||
text: hintText,
|
||||
style: firstLineStyle,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (!hasFirstName || !hasLastName) {
|
||||
final singleLineName = hasFirstName ? trimmedFirstName : trimmedLastName;
|
||||
return SizedBox(
|
||||
width: inputWidth,
|
||||
child: AccountNameSingleLineText(
|
||||
text: singleLineName,
|
||||
style: firstLineStyle,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return SizedBox(
|
||||
width: inputWidth,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AccountNameSingleLineText(
|
||||
text: trimmedFirstName,
|
||||
style: firstLineStyle,
|
||||
),
|
||||
AccountNameSingleLineText(
|
||||
text: trimmedLastName,
|
||||
style: secondLineStyle,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user