mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-11 05:04:35 +00:00
DesktopOrdinalsList widget
This commit is contained in:
parent
8118f98e5e
commit
9d5e33da01
2 changed files with 51 additions and 2 deletions
|
@ -14,7 +14,7 @@ import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:stackwallet/models/isar/models/contact_entry.dart';
|
import 'package:stackwallet/models/isar/models/contact_entry.dart';
|
||||||
import 'package:stackwallet/pages/address_book_views/subviews/add_address_book_entry_view.dart';
|
import 'package:stackwallet/pages/address_book_views/subviews/add_address_book_entry_view.dart';
|
||||||
import 'package:stackwallet/pages/address_book_views/subviews/address_book_filter_view.dart';
|
import 'package:stackwallet/pages/address_book_views/subviews/address_book_filter_view.dart';
|
||||||
import 'package:stackwallet/pages/ordinals/widgets/ordinals_list.dart';
|
import 'package:stackwallet/pages_desktop_specific/ordinals/subwidgets/desktop_ordinals_list.dart';
|
||||||
import 'package:stackwallet/pages_desktop_specific/address_book_view/subwidgets/desktop_address_book_scaffold.dart';
|
import 'package:stackwallet/pages_desktop_specific/address_book_view/subwidgets/desktop_address_book_scaffold.dart';
|
||||||
import 'package:stackwallet/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_details.dart';
|
import 'package:stackwallet/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_details.dart';
|
||||||
import 'package:stackwallet/providers/global/address_book_service_provider.dart';
|
import 'package:stackwallet/providers/global/address_book_service_provider.dart';
|
||||||
|
@ -176,7 +176,7 @@ class _DesktopOrdinals extends ConsumerState<DesktopOrdinalsView> {
|
||||||
height: 16,
|
height: 16,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: OrdinalsList(
|
child: DesktopOrdinalsList(
|
||||||
walletId: widget.walletId,
|
walletId: widget.walletId,
|
||||||
ordinalsFuture: (_manager.wallet as OrdinalsInterface).getOrdinals(),
|
ordinalsFuture: (_manager.wallet as OrdinalsInterface).getOrdinals(),
|
||||||
),
|
),
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:stackwallet/models/ordinal.dart';
|
||||||
|
|
||||||
|
import 'package:stackwallet/pages/ordinals/widgets/ordinal_card.dart';
|
||||||
|
|
||||||
|
class DesktopOrdinalsList extends StatelessWidget {
|
||||||
|
const DesktopOrdinalsList({
|
||||||
|
Key? key,
|
||||||
|
required this.walletId,
|
||||||
|
required this.ordinalsFuture,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
final String walletId;
|
||||||
|
final Future<List<Ordinal>> ordinalsFuture;
|
||||||
|
|
||||||
|
get spacing => 2.0;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return FutureBuilder<List<Ordinal>>(
|
||||||
|
future: ordinalsFuture,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
|
return const CircularProgressIndicator();
|
||||||
|
} else if (snapshot.hasError) {
|
||||||
|
return Text('Error: ${snapshot.error}');
|
||||||
|
} else if (snapshot.hasData) {
|
||||||
|
final List<Ordinal> ordinals = snapshot.data!;
|
||||||
|
return GridView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: ordinals.length,
|
||||||
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisSpacing: spacing as double,
|
||||||
|
mainAxisSpacing: spacing as double,
|
||||||
|
crossAxisCount: 4,
|
||||||
|
childAspectRatio: 6 / 7, // was 3/4, less data displayed now
|
||||||
|
),
|
||||||
|
itemBuilder: (_, i) => OrdinalCard(
|
||||||
|
walletId: walletId,
|
||||||
|
ordinal: ordinals[i],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return const Text('No data found.');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue