givelotus / lotus-vase

A simple reference wallet for Lotus which supports mobile devices.
GNU General Public License v3.0
4 stars 2 forks source link

Add Navigator push route for SendInfo and remove ValueNotifier visible bool #105

Closed chinitadelrey closed 3 years ago

chinitadelrey commented 3 years ago

Though I try passing through the wallet from the parent widget's context, we get a horrible error about Provider. Will take a look again this evening, hoping we can merge in time tonight.

 ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (26606): The following ProviderNotFoundException was thrown building SendInfo(dirty):
I/flutter (26606): Error: Could not find the correct Provider<WalletModel> above this SendInfo Widget
I/flutter (26606): 
I/flutter (26606): This likely happens because you used a `BuildContext` that does not include the provider
I/flutter (26606): of your choice. There are a few common scenarios:
I/flutter (26606): 
I/flutter (26606): - The provider you are trying to read is in a different route.
I/flutter (26606): 
I/flutter (26606):   Providers are "scoped". So if you insert of provider inside a route, then
I/flutter (26606):   other routes will not be able to access that provider.
I/flutter (26606): 
I/flutter (26606): - You used a `BuildContext` that is an ancestor of the provider you are trying to read.
I/flutter (26606): 
I/flutter (26606):   Make sure that SendInfo is under your MultiProvider/Provider<WalletModel>.
I/flutter (26606):   This usually happen when you are creating a provider and trying to read it immediately.
I/flutter (26606): 
I/flutter (26606):   For example, instead of:
I/flutter (26606): 
I/flutter (26606):   ```
I/flutter (26606):   Widget build(BuildContext context) {
I/flutter (26606):     return Provider<Example>(
I/flutter (26606):       create: (_) => Example(),
I/flutter (26606):       // Will throw a ProviderNotFoundError, because `context` is associated
I/flutter (26606):       // to the widget that is the parent of `Provider<Example>`
I/flutter (26606):       child: Text(context.watch<Example>()),
I/flutter (26606):     ),
I/flutter (26606):   }
I/flutter (26606):   ```
I/flutter (26606): 
I/flutter (26606):   consider using `builder` like so:
I/flutter (26606): 
I/flutter (26606):   ```
I/flutter (26606):   Widget build(BuildContext context) {
I/flutter (26606):     return Provider<Example>(
I/flutter (26606):       create: (_) => Example(),
I/flutter (26606):       // we use `builder` to obtain a new `BuildContext` that has access to the provider
I/flutter (26606):       builder: (context) {
I/flutter (26606):         // No longer throws
I/flutter (26606):         return Text(context.watch<Example>()),
I/flutter (26606):       }
I/flutter (26606):     ),
I/flutter (26606):   }
I/flutter (26606):   ```
I/flutter (26606): 
I/flutter (26606): If none of these solutions work, consider asking for help on StackOverflow:
I/flutter (26606): https://stackoverflow.com/questions/tagged/flutter
I/flutter (26606): 
I/flutter (26606): The relevant error-causing widget was:
I/flutter (26606):   SendInfo file:///Users/annjie/Desktop/q4_2020_repos/cashew/lib/tabs/send/send.dart:97:41
I/flutter (26606): 
I/flutter (26606): When the exception was thrown, this was the stack:
I/flutter (26606): #0      Provider._inheritedElementOf (package:provider/src/provider.dart:309:7)
I/flutter (26606): #1      Provider.of (package:provider/src/provider.dart:261:30)
I/flutter (26606): #2      SendInfo.build (package:cashew/tabs/send/send_info.dart:75:34)
I/flutter (26606): #3      StatelessElement.build (package:flutter/src/widgets/framework.dart:4701:28)
I/flutter (26606): #4      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4627:15)
I/flutter (26606): #5      Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
I/flutter (26606): #6      ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4606:5)
I/flutter (26606): #7      ComponentElement.mount (package:flutter/src/widgets/framework.dart:4601:5)
I/flutter (26606): ...     Normal element mounting (132 frames)
I/flutter (26606): #139    Element.inflateWidget (package:flutter/src/widgets/framework.dart:3569:14)
I/flutter (26606): #140    Element.updateChild (package:flutter/src/widgets/framework.dart:3327:18)
I/flutter (26606): #141    RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:5705:32)
I/flutter (26606): #142    MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6246:17)
I/flutter (26606): #143    Element.updateChild (package:flutter/src/widgets/framework.dart:3314:15)
I/flutter (26606): #144    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16)
I/flutter (26606): #145    StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4800:11)
I/flutter (26606): #146    Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
I/flutter (26606): #147    StatefulElement.update (package:flutter/src/widgets/framework.dart:4832:5)
I/flutter (26606): #148    Element.updateChild (package:flutter/src/widgets/framework.dart:3314:15)
I/flutter (26606): #149    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16)
I/flutter (26606): #150    Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
I/flutter (26606): #151    ProxyElement.update (package:flutter/src/widgets/framework.dart:4987:5)
I/flutter (26606): #152    _InheritedNotifierElement.update (package:flutter/src/widgets/inherited_notifier.dart:183:11)
I/flutter (26606): #153    Element.updateChild (package:flutter/src/widgets/framework.dart:3314:15)
I/flutter (26606): #154    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6125:14)
I/flutter (26606): #155    Element.updateChild (package:flutter/src/widgets/framework.dart:3314:15)
I/flutter (26606): #156    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16)
I/flutter (26606): #157    StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4800:11)
I/flutter (26606): #158    Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
I/flutter (26606): #159    StatefulElement.update (package:flutter/src/widgets/framework.dart:4832:5)
I/flutter (26606): #160    Element.updateChild (package:flutter/src/widgets/framework.dart:3314:15)
I/flutter (26606): #161    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6125:14)
I/flutter (26606): #162    Element.updateChild (package:flutter/src/widgets/framework.dart:3314:15)
I/flutter (26606): #163    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6125:14)
I/flutter (26606): #164    Element.updateChild (package:flutter/src/widgets/framework.dart:3314:15)
I/flutter (26606): #165    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16)
I/flutter (26606): #166    Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
I/flutter (26606): #167    StatelessElement.update (package:flutter/src/widgets/framework.dart:4708:5)
I/flutter (26606): #168    Element.updateChild (package:flutter/src/widgets/framework.dart:3314:15)
I/flutter (26606): #169    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16)
I/flutter (26606): #170    Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
I/flutter (26606): #171    ProxyElement.update (package:flutter/src/widgets/framework.dart:4987:5)
I/flutter (26606): #172    Element.updateChild (package:flutter/src/widgets/framework.dart:3314:15)
I/flutter (26606): #173    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4652:16)
I/flutter (26606): #174    StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4800:11)
I/flutter (26606): #175    Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
I/flutter (26606): #176    BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2730:33)
I/flutter (26606): #177    WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:913:20)
I/flutter (26606): #178    RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:302:5)
I/flutter (26606): #179    SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1117:15)
I/flutter (26606): #180    SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1055:9)
I/flutter (26606): #181    SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:971:5)
I/flutter (26606): #185    _invoke (dart:ui/hooks.dart:251:10)
I/flutter (26606): #186    _drawFrame (dart:ui/hooks.dart:209:3)
I/flutter (26606): (elided 3 frames from dart:async)
I/flutter (26606): 
I/flutter (26606): ════════════════════════════════════════════════════════════════════════════════════════════════════