此屏幕是一个抽屉屏幕,它采用身份验证块,以便为用户提供信息并使其能够注销。虽然我使用了正确的提供程序,但我收到了这个错误
The following ProviderNotFoundError was thrown building Pets4allDrawer(dirty):
I/flutter (32011): Error: Could not find the correct Provider<AuthService> above this Pets4allDrawer Widget
I/flutter (32011): To fix, please:
I/flutter (32011): * Ensure the Provider<AuthService> is an ancestor to this Pets4allDrawer Widget
I/flutter (32011): * Provide types to Provider<AuthService>
I/flutter (32011): * Provide types to Consumer<AuthService>
I/flutter (32011): * Provide types to Provider.of<AuthService>()
I/flutter (32011): * Ensure the correct `context` is being used.
Run Code Online (Sandbox Code Playgroud)
我想知道为什么使用 Provider.of(context) 不起作用的问题,调用它时找不到它。
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:pets4all/blocs/authBloc.dart';
import …Run Code Online (Sandbox Code Playgroud) 在这段代码中,我试图在页面的顶部列出按钮或图块的列表,“因为按钮对我而言不合适”。因此,当单击一个时,它将在页面的其余部分返回一个值。
问题是:这里的图块在页面的一半以上扭曲,从而使其看起来不一致。我想限制瓷砖的高度,我尝试将它们放在一个行和一个容器中,但它不起作用。任何帮助将不胜感激。
运行代码后的结果是:
class HomePage extends StatefulWidget {
// const HomePage({Key key}) : super(key: key);
@override
HomePageState createState() {
return new HomePageState();
}
}
class HomePageState extends State<HomePage> {
List<String> temp=new List();
List<String> temp1=['Nile University', 'Smart Village', 'Zewail'];
Map<String,String> map1={};
@override
void initState() {
super.initState();
getplaces(temp);
getuser(map1,'1jKpg81YCO5PoFOa2wWR');
}
Future<List> getuser(temp,String place) async{
List<String> userids=[];
QuerySnapshot usersubs= await Firestore.instance.collection('tempSubs').getDocuments();
QuerySnapshot userid= await Firestore.instance.collection('users').where('place',isEqualTo: place).getDocuments();
userid.documents.forEach((DocumentSnapshot doc,){
usersubs.documents.forEach((DocumentSnapshot doc1){
if(doc.documentID==doc1.documentID){
doc1.data['products'].forEach((k,v){
if( DateTime.fromMillisecondsSinceEpoch(v).day==DateTime.now().day){
int x= DateTime.fromMillisecondsSinceEpoch(v).day;
print('keey equal $k and v …Run Code Online (Sandbox Code Playgroud) 在此小部件中,如果有问题,选项卡会在类型之间导航,它会进入指定的屏幕。如果是论坛,则会转到另一个论坛。问题是我需要将当前点击的类型传递给浮动操作按钮中的按下功能。然而浮动操作按钮位于脚手架主体之外。有没有办法将值传递给浮动操作按钮?
class TabScreen extends StatelessWidget {
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState();
@override
Widget build(BuildContext context) {
final bool showfab = MediaQuery.of(context).viewInsets.bottom == 0.0;
final AuthService authService = Provider.of<AuthService>(context);
return StreamBuilder<List<String>>(
stream: forumServices.forumsTypes$,
builder: (context, snapshot) {
if (!snapshot.hasData) {
return CircularProgressIndicator();
}
List<String> types = snapshot.data;
num tabLen = types.length;
return DefaultTabController(
length: tabLen,
child: Scaffold(
key: _scaffoldKey,
body: CustomScrollView(slivers: <Widget>[
SliverAppBar(
title: Text("kdkdkkd"),
bottom: TabBar(
tabs: types.map((String f) {
return Text(f);
}).toList()),
),
SliverFillRemaining(
child: StreamBuilder<List<Forums>>(
stream: forumServices.forums$, …Run Code Online (Sandbox Code Playgroud) 我想知道在setState不为变量设置新值的情况下调用背后的要点。
readLocal() async {
prefs = await SharedPreferences.getInstance();
id = prefs.getString('id') ?? '';
if (id.hashCode <= peerId.hashCode) {
groupChatId = '$id-$peerId';
} else {
groupChatId = '$peerId-$id';
}
setState(() {});
}
Run Code Online (Sandbox Code Playgroud) 通过单击showBottomSheet弹出导航到另一屏幕的屏幕时,以下代码引发此错误。我不明白为什么会这样。
class _CheckoutButtonState extends State<_CheckoutButton> {
final GlobalKey<ScaffoldState> _globalKey = GlobalKey();
final DateTime deliveryTime = DateTime.now().add(Duration(minutes: 30));
final double deliveryPrice = 5.00;
@override
Widget build(BuildContext context) {
SubscriptionService subscriptionService =
Provider.of<SubscriptionService>(context);
CheckoutService checkoutService = Provider.of<CheckoutService>(context);
return Container(
height: 48.0,
width: MediaQuery.of(context).size.width * 0.75,
child: StreamBuilder(
stream: subscriptionService.subscription$,
builder: (_, AsyncSnapshot<Subscription> snapshot) {
if (!snapshot.hasData) {
return Text("CHECKOUT");
}
final Subscription subscription = snapshot.data;
final List<Order> orders = subscription.orders;
final Package package = subscription.package;
num discount = _getDiscount(package);
num price = …Run Code Online (Sandbox Code Playgroud) 在尝试获取 SHA 证书指纹时,我运行了这一行,这就是结果行:
keytool -list -v -keystore %USERPROFILE%\.android\debug.keystore -alias androiddebugkey -storepass android -keypass android
Run Code Online (Sandbox Code Playgroud)
我还应该做什么来解决这个错误?
C:\>keytool -list -v -keystore %USERPROFILE%\.android\debug.keystore -alias androiddebugkey -storepass android -keypass android
Illegal option: sisy\.android\debug.keystore
keytool -list [OPTION]...
Lists entries in a keystore
Options:
-rfc output in RFC style
-alias <alias> alias name of the entry to process
-keystore <keystore> keystore name
-cacerts access the cacerts keystore
-storepass <arg> keystore password
-storetype <type> keystore type
-providername <name> provider name
-addprovider <name> add security provider by name …Run Code Online (Sandbox Code Playgroud)