Update standard lists

This commit is contained in:
tuxpizza 2024-12-20 01:31:50 -05:00
parent 8ced5a9970
commit 859d1d540c
4 changed files with 82 additions and 17 deletions

View file

@ -203,14 +203,14 @@ class _ContactPageBodyState extends State<ContactPageBody> with SingleTickerProv
), ),
), ),
leading: _buildCurrencyIcon(activeContact), leading: _buildCurrencyIcon(activeContact),
tilePadding: const EdgeInsets.only(left: 12, right: 12), tilePadding: const EdgeInsets.only(left: 16, right: 16),
childrenPadding: const EdgeInsets.only(left: 16), childrenPadding: const EdgeInsets.only(left: 16),
expandedCrossAxisAlignment: CrossAxisAlignment.start, expandedCrossAxisAlignment: CrossAxisAlignment.start,
expandedAlignment: Alignment.topLeft, expandedAlignment: Alignment.topLeft,
backgroundColor: Theme.of(context).cardColor, backgroundColor: Theme.of(context).cardColor,
collapsedBackgroundColor: Theme.of(context).cardColor, collapsedBackgroundColor: Theme.of(context).cardColor,
collapsedShape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), collapsedShape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
children: groupContacts.map((contact) => generateRaw(context, contact)).toList(), children: groupContacts.map((contact) => generateRaw(context, contact)).toList(),
), ),
); );
@ -245,11 +245,11 @@ class _ContactPageBodyState extends State<ContactPageBody> with SingleTickerProv
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(8)), borderRadius: BorderRadius.all(Radius.circular(10)),
color: Theme.of(context).cardColor, color: Theme.of(context).cardColor,
), ),
margin: const EdgeInsets.only(top: 4, bottom: 4, left: 16, right: 16), margin: const EdgeInsets.only(top: 4, bottom: 4, left: 16, right: 16),
padding: const EdgeInsets.only(top: 16, bottom: 16, right: 12, left: 12), padding: const EdgeInsets.only(top: 16, bottom: 16, right: 16, left: 16),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -395,7 +395,7 @@ class _ContactListBodyState extends State<ContactListBody> {
color: Theme.of(context).cardColor, color: Theme.of(context).cardColor,
), ),
margin: const EdgeInsets.only(top: 4, bottom: 4, left: 16, right: 16), margin: const EdgeInsets.only(top: 4, bottom: 4, left: 16, right: 16),
padding: const EdgeInsets.only(top: 16, bottom: 16, right: 12, left: 12), padding: const EdgeInsets.only(top: 16, bottom: 16, right: 16, left: 16),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,

View file

@ -18,6 +18,37 @@ class NodeListRow extends StandardListRow {
final Node node; final Node node;
final bool isPow; final bool isPow;
@override
Widget build(BuildContext context) {
final leading = buildLeading(context);
final trailing = buildTrailing(context);
return Container(
height: 56,
padding: EdgeInsets.only(left: 12, right: 12, top: 2, bottom: 2),
margin: EdgeInsets.only(top: 2, bottom: 2),
child: TextButton(
onPressed: () => onTap?.call(context),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Theme.of(context).cardColor),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10)
),
),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
if (leading != null) leading,
buildCenter(context, hasLeftOffset: leading != null),
if (trailing != null) trailing,
],
),
),
);
}
@override @override
Widget buildLeading(BuildContext context) { Widget buildLeading(BuildContext context) {
return FutureBuilder( return FutureBuilder(
@ -56,6 +87,36 @@ class NodeHeaderListRow extends StandardListRow {
NodeHeaderListRow({required String title, required void Function(BuildContext context) onTap}) NodeHeaderListRow({required String title, required void Function(BuildContext context) onTap})
: super(title: title, onTap: onTap, isSelected: false); : super(title: title, onTap: onTap, isSelected: false);
@override
Widget build(BuildContext context) {
final leading = buildLeading(context);
final trailing = buildTrailing(context);
return Container(
height: 56,
padding: EdgeInsets.only(left: 12, right: 12, top: 2, bottom: 2),
child: TextButton(
onPressed: () => onTap?.call(context),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Theme.of(context).cardColor),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10)
),
),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
if (leading != null) leading,
buildCenter(context, hasLeftOffset: leading != null),
if (trailing != null) trailing,
],
),
),
);
}
@override @override
Widget buildTrailing(BuildContext context) { Widget buildTrailing(BuildContext context) {
return SizedBox( return SizedBox(

View file

@ -34,7 +34,6 @@ class ManageNodesPage extends BasePage {
onTap: (_) async => await Navigator.of(context).pushNamed(Routes.newNode), onTap: (_) async => await Navigator.of(context).pushNamed(Routes.newNode),
), ),
), ),
const StandardListSeparator(padding: EdgeInsets.symmetric(horizontal: 24)),
SizedBox(height: 20), SizedBox(height: 20),
Observer( Observer(
builder: (BuildContext context) { builder: (BuildContext context) {

View file

@ -21,15 +21,19 @@ class StandardListRow extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final leading = buildLeading(context); final leading = buildLeading(context);
final trailing = buildTrailing(context); final trailing = buildTrailing(context);
return Container(
return InkWell(
onTap: () => onTap?.call(context),
child: Container(
height: 56, height: 56,
padding: EdgeInsets.only(left: 24, right: 24), padding: EdgeInsets.only(left: 12, right: 12),
decoration: decoration ?? child: TextButton(
BoxDecoration( onPressed: () => onTap?.call(context),
color: Theme.of(context).colorScheme.background, style: ButtonStyle(
//backgroundColor: MaterialStateProperty.all(Theme.of(context).cardColor),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10)
),
),
),
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -97,10 +101,10 @@ class StandardListSeparator extends StatelessWidget {
return Container( return Container(
height: height, height: height,
padding: padding, padding: padding,
color: Theme.of(context).colorScheme.background, color: Colors.transparent,
child: Container( child: Container(
height: height, height: height,
color: Theme.of(context).extension<CakeTextTheme>()!.textfieldUnderlineColor, color: Colors.transparent,
), ),
); );
} }
@ -140,6 +144,7 @@ class SectionStandardList extends StatelessWidget {
final int sectionCount; final int sectionCount;
final bool hasTopSeparator; final bool hasTopSeparator;
final int Function(int sectionIndex) itemCounter; final int Function(int sectionIndex) itemCounter;
final Widget Function(int sectionIndex, int itemIndex) itemBuilder; final Widget Function(int sectionIndex, int itemIndex) itemBuilder;
final Widget Function(int sectionIndex)? sectionTitleBuilder; final Widget Function(int sectionIndex)? sectionTitleBuilder;