removed status from recipient address book
This commit is contained in:
@@ -1,61 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import 'package:pshared/models/recipient/filter.dart';
|
|
||||||
|
|
||||||
|
|
||||||
class RecipientFilterButton extends StatelessWidget {
|
|
||||||
final String text;
|
|
||||||
final RecipientFilter filter;
|
|
||||||
final RecipientFilter selected;
|
|
||||||
final ValueChanged<RecipientFilter> onTap;
|
|
||||||
|
|
||||||
const RecipientFilterButton({
|
|
||||||
super.key,
|
|
||||||
required this.text,
|
|
||||||
required this.filter,
|
|
||||||
required this.selected,
|
|
||||||
required this.onTap,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final isSelected = selected == filter;
|
|
||||||
final theme = Theme.of(context).colorScheme;
|
|
||||||
|
|
||||||
return ElevatedButton(
|
|
||||||
onPressed: () => onTap(filter),
|
|
||||||
style: ButtonStyle(
|
|
||||||
backgroundColor: WidgetStateProperty.all(Colors.transparent),
|
|
||||||
overlayColor: WidgetStateProperty.all(Colors.transparent),
|
|
||||||
shadowColor: WidgetStateProperty.all(Colors.transparent),
|
|
||||||
elevation: WidgetStateProperty.all(0),
|
|
||||||
),
|
|
||||||
child: IntrinsicWidth(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
text,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
color: isSelected
|
|
||||||
? theme.onPrimaryContainer
|
|
||||||
: theme.onPrimaryContainer.withAlpha(60),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 2,
|
|
||||||
child: DecoratedBox(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: isSelected
|
|
||||||
? theme.primary
|
|
||||||
: theme.onPrimaryContainer.withAlpha(60),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,11 +3,9 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import 'package:pshared/models/recipient/recipient.dart';
|
import 'package:pshared/models/recipient/recipient.dart';
|
||||||
import 'package:pshared/models/recipient/filter.dart';
|
|
||||||
import 'package:pshared/provider/recipient/provider.dart';
|
import 'package:pshared/provider/recipient/provider.dart';
|
||||||
import 'package:pweb/pages/address_book/page/empty.dart';
|
import 'package:pweb/pages/address_book/page/empty.dart';
|
||||||
|
|
||||||
import 'package:pweb/pages/address_book/page/filter_button.dart';
|
|
||||||
import 'package:pweb/pages/address_book/page/header.dart';
|
import 'package:pweb/pages/address_book/page/header.dart';
|
||||||
import 'package:pweb/pages/address_book/page/list.dart';
|
import 'package:pweb/pages/address_book/page/list.dart';
|
||||||
import 'package:pweb/pages/address_book/page/search.dart';
|
import 'package:pweb/pages/address_book/page/search.dart';
|
||||||
@@ -42,7 +40,6 @@ class RecipientAddressBookPage extends StatefulWidget {
|
|||||||
class _RecipientAddressBookPageState extends State<RecipientAddressBookPage> {
|
class _RecipientAddressBookPageState extends State<RecipientAddressBookPage> {
|
||||||
late final TextEditingController _searchController;
|
late final TextEditingController _searchController;
|
||||||
late final FocusNode _searchFocusNode;
|
late final FocusNode _searchFocusNode;
|
||||||
RecipientFilter _selectedFilter = RecipientFilter.all;
|
|
||||||
String _query = '';
|
String _query = '';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -65,19 +62,12 @@ class _RecipientAddressBookPageState extends State<RecipientAddressBookPage> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _setFilter(RecipientFilter filter) {
|
|
||||||
setState(() {
|
|
||||||
_selectedFilter = filter;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final loc = AppLocalizations.of(context)!;
|
final loc = AppLocalizations.of(context)!;
|
||||||
final provider = context.watch<RecipientsProvider>();
|
final provider = context.watch<RecipientsProvider>();
|
||||||
final filteredRecipients = filterRecipients(
|
final filteredRecipients = filterRecipients(
|
||||||
recipients: provider.recipients,
|
recipients: provider.recipients,
|
||||||
filter: _selectedFilter,
|
|
||||||
query: _query,
|
query: _query,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -100,34 +90,6 @@ class _RecipientAddressBookPageState extends State<RecipientAddressBookPage> {
|
|||||||
onChanged: _setQuery,
|
onChanged: _setQuery,
|
||||||
),
|
),
|
||||||
const SizedBox(height: RecipientAddressBookPage._bigBox),
|
const SizedBox(height: RecipientAddressBookPage._bigBox),
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
RecipientFilterButton(
|
|
||||||
text: loc.allStatus,
|
|
||||||
filter: RecipientFilter.all,
|
|
||||||
selected: _selectedFilter,
|
|
||||||
onTap: _setFilter,
|
|
||||||
),
|
|
||||||
RecipientFilterButton(
|
|
||||||
text: loc.readyStatus,
|
|
||||||
filter: RecipientFilter.ready,
|
|
||||||
selected: _selectedFilter,
|
|
||||||
onTap: _setFilter,
|
|
||||||
),
|
|
||||||
RecipientFilterButton(
|
|
||||||
text: loc.registeredStatus,
|
|
||||||
filter: RecipientFilter.registered,
|
|
||||||
selected: _selectedFilter,
|
|
||||||
onTap: _setFilter,
|
|
||||||
),
|
|
||||||
RecipientFilterButton(
|
|
||||||
text: loc.notRegisteredStatus,
|
|
||||||
filter: RecipientFilter.notRegistered,
|
|
||||||
selected: _selectedFilter,
|
|
||||||
onTap: _setFilter,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: RecipientAddressBookPage._expandedHeight,
|
height: RecipientAddressBookPage._expandedHeight,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import 'package:pshared/models/recipient/recipient.dart';
|
|||||||
import 'package:pweb/pages/address_book/page/recipient/actions.dart';
|
import 'package:pweb/pages/address_book/page/recipient/actions.dart';
|
||||||
import 'package:pweb/pages/address_book/page/recipient/info_column.dart';
|
import 'package:pweb/pages/address_book/page/recipient/info_column.dart';
|
||||||
import 'package:pweb/pages/address_book/page/recipient/payment_row.dart';
|
import 'package:pweb/pages/address_book/page/recipient/payment_row.dart';
|
||||||
import 'package:pweb/pages/address_book/page/recipient/status.dart';
|
|
||||||
import 'package:pweb/pages/dashboard/payouts/single/address_book/avatar.dart';
|
import 'package:pweb/pages/dashboard/payouts/single/address_book/avatar.dart';
|
||||||
|
|
||||||
|
|
||||||
@@ -18,7 +17,6 @@ class RecipientAddressBookItem extends StatefulWidget {
|
|||||||
final double borderRadius;
|
final double borderRadius;
|
||||||
final double elevation;
|
final double elevation;
|
||||||
final EdgeInsetsGeometry padding;
|
final EdgeInsetsGeometry padding;
|
||||||
final double spacingDotAvatar;
|
|
||||||
final double spacingAvatarInfo;
|
final double spacingAvatarInfo;
|
||||||
final double spacingBottom;
|
final double spacingBottom;
|
||||||
final double avatarRadius;
|
final double avatarRadius;
|
||||||
@@ -32,7 +30,6 @@ class RecipientAddressBookItem extends StatefulWidget {
|
|||||||
this.borderRadius = 12,
|
this.borderRadius = 12,
|
||||||
this.elevation = 4,
|
this.elevation = 4,
|
||||||
this.padding = const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
this.padding = const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
this.spacingDotAvatar = 8,
|
|
||||||
this.spacingAvatarInfo = 16,
|
this.spacingAvatarInfo = 16,
|
||||||
this.spacingBottom = 10,
|
this.spacingBottom = 10,
|
||||||
this.avatarRadius = 24,
|
this.avatarRadius = 24,
|
||||||
@@ -65,8 +62,6 @@ class _RecipientAddressBookItemState extends State<RecipientAddressBookItem> {
|
|||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
RecipientStatusDot(status: recipient.status),
|
|
||||||
SizedBox(width: widget.spacingDotAvatar),
|
|
||||||
RecipientAvatar(
|
RecipientAvatar(
|
||||||
name: recipient.name,
|
name: recipient.name,
|
||||||
avatarUrl: recipient.avatarUrl,
|
avatarUrl: recipient.avatarUrl,
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import 'package:pshared/models/recipient/status.dart';
|
|
||||||
|
|
||||||
|
|
||||||
class RecipientStatusDot extends StatelessWidget {
|
|
||||||
final RecipientStatus status;
|
|
||||||
|
|
||||||
const RecipientStatusDot({super.key, required this.status});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
Color color;
|
|
||||||
switch (status) {
|
|
||||||
case RecipientStatus.ready:
|
|
||||||
color = Colors.green;
|
|
||||||
break;
|
|
||||||
case RecipientStatus.notRegistered:
|
|
||||||
color = Theme.of(context).colorScheme.error;
|
|
||||||
break;
|
|
||||||
case RecipientStatus.registered:
|
|
||||||
color = Colors.yellow;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Container(
|
|
||||||
width: 12,
|
|
||||||
height: 12,
|
|
||||||
decoration: BoxDecoration(shape: BoxShape.circle, color: color),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user