hook up details view to OrdinalsInterface

This commit is contained in:
sneurlax 2023-07-21 10:43:02 -05:00
parent f750bbfe10
commit 65e8c34e34
2 changed files with 29 additions and 28 deletions

View file

@ -3,7 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:stackwallet/models/ordinal.dart'; import 'package:stackwallet/dto/ordinals/inscription_data.dart';
import 'package:stackwallet/notifications/show_flush_bar.dart'; import 'package:stackwallet/notifications/show_flush_bar.dart';
import 'package:stackwallet/pages/ordinals/widgets/dialogs.dart'; import 'package:stackwallet/pages/ordinals/widgets/dialogs.dart';
import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/stack_colors.dart';
@ -15,20 +15,21 @@ import 'package:stackwallet/widgets/desktop/primary_button.dart';
import 'package:stackwallet/widgets/desktop/secondary_button.dart'; import 'package:stackwallet/widgets/desktop/secondary_button.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart'; import 'package:stackwallet/widgets/rounded_white_container.dart';
class OrdinalDetailsView extends StatefulWidget { class OrdinalDetailsView extends StatefulWidget {
const OrdinalDetailsView({ const OrdinalDetailsView({
super.key, Key? key,
required this.walletId, required this.walletId,
required this.ordinal, required this.inscriptionData,
}); }) : super(key: key);
final String walletId; final String walletId;
final Ordinal ordinal; final InscriptionData inscriptionData;
static const routeName = "/ordinalDetailsView"; static const routeName = "/ordinalDetailsView";
@override @override
State<OrdinalDetailsView> createState() => _OrdinalDetailsViewState(); _OrdinalDetailsViewState createState() => _OrdinalDetailsViewState();
} }
class _OrdinalDetailsViewState extends State<OrdinalDetailsView> { class _OrdinalDetailsViewState extends State<OrdinalDetailsView> {
@ -40,10 +41,10 @@ class _OrdinalDetailsViewState extends State<OrdinalDetailsView> {
child: SafeArea( child: SafeArea(
child: Scaffold( child: Scaffold(
backgroundColor: backgroundColor:
Theme.of(context).extension<StackColors>()!.background, Theme.of(context).extension<StackColors>()!.background,
appBar: AppBar( appBar: AppBar(
backgroundColor: backgroundColor:
Theme.of(context).extension<StackColors>()!.background, Theme.of(context).extension<StackColors>()!.background,
leading: const AppBarBackButton(), leading: const AppBarBackButton(),
title: Text( title: Text(
"Ordinal details", "Ordinal details",
@ -61,20 +62,20 @@ class _OrdinalDetailsViewState extends State<OrdinalDetailsView> {
horizontal: 39, horizontal: 39,
), ),
child: _OrdinalImageGroup( child: _OrdinalImageGroup(
ordinal: widget.ordinal, inscriptionData: widget.inscriptionData,
walletId: widget.walletId, walletId: widget.walletId,
), ),
), ),
_DetailsItemWCopy( _DetailsItemWCopy(
title: "Inscription number", title: "Inscription number",
data: widget.ordinal.inscription, data: widget.inscriptionData.inscriptionNumber.toString(),
), ),
const SizedBox( const SizedBox(
height: _spacing, height: _spacing,
), ),
_DetailsItemWCopy( _DetailsItemWCopy(
title: "Rank", title: "ID",
data: widget.ordinal.rank, data: widget.inscriptionData.inscriptionId,
), ),
const SizedBox( const SizedBox(
height: _spacing, height: _spacing,
@ -85,21 +86,21 @@ class _OrdinalDetailsViewState extends State<OrdinalDetailsView> {
), ),
_DetailsItemWCopy( _DetailsItemWCopy(
title: "Amount", title: "Amount",
data: "FIXME", data: "${widget.inscriptionData.outputValue}",
), ),
const SizedBox( const SizedBox(
height: _spacing, height: _spacing,
), ),
_DetailsItemWCopy( _DetailsItemWCopy(
title: "Owner address", title: "Owner address",
data: "FIXME", data: widget.inscriptionData.address,
), ),
const SizedBox( const SizedBox(
height: _spacing, height: _spacing,
), ),
_DetailsItemWCopy( _DetailsItemWCopy(
title: "Transaction ID", title: "Transaction ID",
data: "FIXME", data: widget.inscriptionData.genesisTransaction,
), ),
const SizedBox( const SizedBox(
height: _spacing, height: _spacing,
@ -116,10 +117,10 @@ class _OrdinalDetailsViewState extends State<OrdinalDetailsView> {
class _DetailsItemWCopy extends StatelessWidget { class _DetailsItemWCopy extends StatelessWidget {
const _DetailsItemWCopy({ const _DetailsItemWCopy({
super.key, Key? key,
required this.title, required this.title,
required this.data, required this.data,
}); }) : super(key: key);
final String title; final String title;
final String data; final String data;
@ -153,7 +154,7 @@ class _DetailsItemWCopy extends StatelessWidget {
child: SvgPicture.asset( child: SvgPicture.asset(
Assets.svg.copy, Assets.svg.copy,
color: color:
Theme.of(context).extension<StackColors>()!.infoItemIcons, Theme.of(context).extension<StackColors>()!.infoItemIcons,
width: 12, width: 12,
), ),
), ),
@ -174,13 +175,13 @@ class _DetailsItemWCopy extends StatelessWidget {
class _OrdinalImageGroup extends StatelessWidget { class _OrdinalImageGroup extends StatelessWidget {
const _OrdinalImageGroup({ const _OrdinalImageGroup({
super.key, Key? key,
required this.walletId, required this.walletId,
required this.ordinal, required this.inscriptionData,
}); }) : super(key: key);
final String walletId; final String walletId;
final Ordinal ordinal; final InscriptionData inscriptionData;
static const _spacing = 12.0; static const _spacing = 12.0;
@ -191,7 +192,7 @@ class _OrdinalImageGroup extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text( Text(
ordinal.name, "${inscriptionData.inscriptionId}", // Use any other property you want
style: STextStyles.w600_16(context), style: STextStyles.w600_16(context),
), ),
const SizedBox( const SizedBox(

View file

@ -12,13 +12,15 @@ import 'package:flutter/cupertino.dart';
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:isar/isar.dart'; import 'package:isar/isar.dart';
import 'package:stackwallet/dto/ordinals/inscription_data.dart';
import 'package:stackwallet/models/add_wallet_list_entity/add_wallet_list_entity.dart'; import 'package:stackwallet/models/add_wallet_list_entity/add_wallet_list_entity.dart';
import 'package:stackwallet/models/add_wallet_list_entity/sub_classes/eth_token_entity.dart'; import 'package:stackwallet/models/add_wallet_list_entity/sub_classes/eth_token_entity.dart';
import 'package:stackwallet/models/buy/response_objects/quote.dart'; import 'package:stackwallet/models/buy/response_objects/quote.dart';
import 'package:stackwallet/models/exchange/incomplete_exchange.dart'; import 'package:stackwallet/models/exchange/incomplete_exchange.dart';
import 'package:stackwallet/models/exchange/response_objects/trade.dart'; import 'package:stackwallet/models/exchange/response_objects/trade.dart';
import 'package:stackwallet/models/isar/models/contact_entry.dart';
import 'package:stackwallet/models/isar/models/isar_models.dart'; import 'package:stackwallet/models/isar/models/isar_models.dart';
import 'package:stackwallet/models/ordinal.dart'; import 'package:stackwallet/models/ordinal.dart'; // TODO generalize InscriptionData -> Ordinal
import 'package:stackwallet/models/paynym/paynym_account_lite.dart'; import 'package:stackwallet/models/paynym/paynym_account_lite.dart';
import 'package:stackwallet/models/send_view_auto_fill_data.dart'; import 'package:stackwallet/models/send_view_auto_fill_data.dart';
import 'package:stackwallet/pages/add_wallet_views/add_token_view/add_custom_token_view.dart'; import 'package:stackwallet/pages/add_wallet_views/add_token_view/add_custom_token_view.dart';
@ -168,8 +170,6 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/widgets/choose_coin_view.dart'; import 'package:stackwallet/widgets/choose_coin_view.dart';
import 'package:tuple/tuple.dart'; import 'package:tuple/tuple.dart';
import 'models/isar/models/contact_entry.dart';
/* /*
* This file contains all the routes for the app. * This file contains all the routes for the app.
* To add a new route, add it to the switch statement in the generateRoute method. * To add a new route, add it to the switch statement in the generateRoute method.
@ -423,12 +423,12 @@ class RouteGenerator {
return _routeError("${settings.name} invalid args: ${args.toString()}"); return _routeError("${settings.name} invalid args: ${args.toString()}");
case OrdinalDetailsView.routeName: case OrdinalDetailsView.routeName:
if (args is ({Ordinal ordinal, String walletId})) { if (args is ({InscriptionData inscriptionData, String walletId})) {
return getRoute( return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute, shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => OrdinalDetailsView( builder: (_) => OrdinalDetailsView(
walletId: args.walletId, walletId: args.walletId,
ordinal: args.ordinal, inscriptionData: args.inscriptionData,
), ),
settings: RouteSettings( settings: RouteSettings(
name: settings.name, name: settings.name,