mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 01:37:54 +00:00
followers/following paynym lists clean up
This commit is contained in:
parent
3069ebeae9
commit
8c0366904a
4 changed files with 95 additions and 115 deletions
|
@ -165,7 +165,7 @@ class _AddNewPaynymFollowViewState
|
||||||
),
|
),
|
||||||
titleSpacing: 0,
|
titleSpacing: 0,
|
||||||
title: Text(
|
title: Text(
|
||||||
"Add new",
|
"New follow",
|
||||||
style: STextStyles.navBarTitle(context),
|
style: STextStyles.navBarTitle(context),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
|
@ -201,7 +201,7 @@ class _AddNewPaynymFollowViewState
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 32),
|
padding: const EdgeInsets.only(left: 32),
|
||||||
child: Text(
|
child: Text(
|
||||||
"Add new",
|
"New follow",
|
||||||
style: STextStyles.desktopH3(context),
|
style: STextStyles.desktopH3(context),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -138,7 +138,7 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"Add new",
|
"Follow",
|
||||||
style:
|
style:
|
||||||
STextStyles.desktopButtonSecondaryEnabled(
|
STextStyles.desktopButtonSecondaryEnabled(
|
||||||
context)
|
context)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:stackwallet/pages/paynym/subwidgets/paynym_card.dart';
|
import 'package:stackwallet/pages/paynym/subwidgets/paynym_card.dart';
|
||||||
|
@ -48,13 +50,19 @@ class _PaynymFollowersListState extends ConsumerState<PaynymFollowersList> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final count =
|
final followers =
|
||||||
ref.watch(myPaynymAccountStateProvider.state).state?.followers.length ??
|
ref.watch(myPaynymAccountStateProvider.state).state?.followers;
|
||||||
0;
|
final count = followers?.length ?? 0;
|
||||||
if (count == 0) {
|
|
||||||
return Column(
|
return ListView.separated(
|
||||||
children: [
|
itemCount: max(count, 1),
|
||||||
RoundedWhiteContainer(
|
separatorBuilder: (BuildContext context, int index) => Container(
|
||||||
|
height: 1.5,
|
||||||
|
color: Colors.transparent,
|
||||||
|
),
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
if (count == 0) {
|
||||||
|
return RoundedWhiteContainer(
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
@ -71,56 +79,38 @@ class _PaynymFollowersListState extends ConsumerState<PaynymFollowersList> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
],
|
} else if (count == 1) {
|
||||||
);
|
return RoundedWhiteContainer(
|
||||||
} else {
|
padding: const EdgeInsets.all(0),
|
||||||
final followers =
|
child: PaynymCard(
|
||||||
ref.watch(myPaynymAccountStateProvider.state).state!.followers;
|
walletId: widget.walletId,
|
||||||
|
label: followers![0].nymName,
|
||||||
if (count == 1) {
|
paymentCodeString: followers[0].code,
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
RoundedWhiteContainer(
|
|
||||||
padding: const EdgeInsets.all(0),
|
|
||||||
child: PaynymCard(
|
|
||||||
walletId: widget.walletId,
|
|
||||||
label: followers[0].nymName,
|
|
||||||
paymentCodeString: followers[0].code,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
);
|
||||||
);
|
} else {
|
||||||
} else {
|
BorderRadius? borderRadius;
|
||||||
return ListView.separated(
|
if (index == 0) {
|
||||||
itemCount: count,
|
borderRadius = _borderRadiusFirst;
|
||||||
separatorBuilder: (BuildContext context, int index) => Container(
|
} else if (index == count - 1) {
|
||||||
height: 1.5,
|
borderRadius = _borderRadiusLast;
|
||||||
color: Colors.transparent,
|
}
|
||||||
),
|
|
||||||
itemBuilder: (BuildContext context, int index) {
|
|
||||||
BorderRadius? borderRadius;
|
|
||||||
if (index == 0) {
|
|
||||||
borderRadius = _borderRadiusFirst;
|
|
||||||
} else if (index == count - 1) {
|
|
||||||
borderRadius = _borderRadiusLast;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
key: Key("paynymCardKey_${followers[index].nymId}"),
|
key: Key("paynymCardKey_${followers![index].nymId}"),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: borderRadius,
|
borderRadius: borderRadius,
|
||||||
color: Theme.of(context).extension<StackColors>()!.popupBG,
|
color: Theme.of(context).extension<StackColors>()!.popupBG,
|
||||||
),
|
),
|
||||||
child: PaynymCard(
|
child: PaynymCard(
|
||||||
walletId: widget.walletId,
|
walletId: widget.walletId,
|
||||||
label: followers[index].nymName,
|
label: followers[index].nymName,
|
||||||
paymentCodeString: followers[index].code,
|
paymentCodeString: followers[index].code,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
);
|
},
|
||||||
}
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:stackwallet/pages/paynym/subwidgets/paynym_card.dart';
|
import 'package:stackwallet/pages/paynym/subwidgets/paynym_card.dart';
|
||||||
|
@ -48,13 +50,19 @@ class _PaynymFollowingListState extends ConsumerState<PaynymFollowingList> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final count =
|
final following =
|
||||||
ref.watch(myPaynymAccountStateProvider.state).state?.following.length ??
|
ref.watch(myPaynymAccountStateProvider.state).state?.following;
|
||||||
0;
|
final count = following?.length ?? 0;
|
||||||
if (count == 0) {
|
|
||||||
return Column(
|
return ListView.separated(
|
||||||
children: [
|
itemCount: max(count, 1),
|
||||||
RoundedWhiteContainer(
|
separatorBuilder: (BuildContext context, int index) => Container(
|
||||||
|
height: 1.5,
|
||||||
|
color: Colors.transparent,
|
||||||
|
),
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
if (count == 0) {
|
||||||
|
return RoundedWhiteContainer(
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
@ -71,56 +79,38 @@ class _PaynymFollowingListState extends ConsumerState<PaynymFollowingList> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
],
|
} else if (count == 1) {
|
||||||
);
|
return RoundedWhiteContainer(
|
||||||
} else {
|
padding: const EdgeInsets.all(0),
|
||||||
final following =
|
child: PaynymCard(
|
||||||
ref.watch(myPaynymAccountStateProvider.state).state!.following;
|
walletId: widget.walletId,
|
||||||
|
label: following![0].nymName,
|
||||||
if (count == 1) {
|
paymentCodeString: following[0].code,
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
RoundedWhiteContainer(
|
|
||||||
padding: const EdgeInsets.all(0),
|
|
||||||
child: PaynymCard(
|
|
||||||
walletId: widget.walletId,
|
|
||||||
label: following[0].nymName,
|
|
||||||
paymentCodeString: following[0].code,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
);
|
||||||
);
|
} else {
|
||||||
} else {
|
BorderRadius? borderRadius;
|
||||||
return ListView.separated(
|
if (index == 0) {
|
||||||
itemCount: count,
|
borderRadius = _borderRadiusFirst;
|
||||||
separatorBuilder: (BuildContext context, int index) => Container(
|
} else if (index == count - 1) {
|
||||||
height: 1.5,
|
borderRadius = _borderRadiusLast;
|
||||||
color: Colors.transparent,
|
}
|
||||||
),
|
|
||||||
itemBuilder: (BuildContext context, int index) {
|
|
||||||
BorderRadius? borderRadius;
|
|
||||||
if (index == 0) {
|
|
||||||
borderRadius = _borderRadiusFirst;
|
|
||||||
} else if (index == count - 1) {
|
|
||||||
borderRadius = _borderRadiusLast;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
key: Key("paynymCardKey_${following[index].nymId}"),
|
key: Key("paynymCardKey_${following![index].nymId}"),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: borderRadius,
|
borderRadius: borderRadius,
|
||||||
color: Theme.of(context).extension<StackColors>()!.popupBG,
|
color: Theme.of(context).extension<StackColors>()!.popupBG,
|
||||||
),
|
),
|
||||||
child: PaynymCard(
|
child: PaynymCard(
|
||||||
walletId: widget.walletId,
|
walletId: widget.walletId,
|
||||||
label: following[index].nymName,
|
label: following[index].nymName,
|
||||||
paymentCodeString: following[index].code,
|
paymentCodeString: following[index].code,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
);
|
},
|
||||||
}
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue