gpt4 book ai didi

Flutter 应用程序在发布应用程序模式下显示白屏?

转载 作者:行者123 更新时间:2023-12-04 01:12:01 25 4
gpt4 key购买 nike

我在 flutter 应用程序中面临非常奇怪的问题!在 Debug模式下测试我的应用程序时它工作正常,而在 Release模式下它显示白屏。此应用程序已在 Playstore 中发布。几天后我改变了这个应用程序。我想发布第二个版本。当我尝试构建发布 apk 时,它在 Debug模式下工作正常时显示白屏。为什么会发生?是flutter版本问题吗?
image one
image two
这是代码

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:tv/Online.dart';
import 'package:tv/paypal.dart';
import 'package:url_launcher/url_launcher.dart';


class Donateus extends StatefulWidget {
@override
_DonateusState createState() => _DonateusState();
}

class _DonateusState extends State<Donateus> {
bool _isExpandedonline=false;
bool _isExpandedpaypal=false;
bool _isExpandedetransfer=false;
bool _isExpandedtexttogive=false;

void customLaunch(command) async {
if (await canLaunch(command)) {
await launch(command);
} else {
print(' could not launch $command');
}
}
@override
void initState() {
// TODO: implement initState
super.initState();

}
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
scrollDirection: Axis.vertical,
child:Padding(
padding: EdgeInsets.all(10),

child: Container(
child:Expanded(
child: Column(
children: <Widget>[
Text(
'WAYS TO DONATE',
style: TextStyle(
fontFamily: 'TT NORMS',
fontSize: 20,
fontWeight: FontWeight.w100,
),


),
Padding(
padding: EdgeInsets.only(left: 10),
child: Text(
'All of our Donations are processed through Cornerstone Asian Church.We are a registered Canadian Charity (842869265RR0001). A Canadian Tax-deductible receipt will be issued to you.',
style: TextStyle(

fontSize: 14
),
),
),
Padding(
padding: EdgeInsets.only(left: 10),
child: ExpansionTile(
onExpansionChanged: (value) {
_isExpandedonline=value;
setState(() {});
},
children: <Widget>[
Text(
'Give a single gift, or schedule a recurring amount by using your Credit cards (i.e Mastercard, VISA, AMEX).'
'Note: Cornerstone uses the giving provider, Tithe.ly to securely process online donations from all over the world. Our Church will cover all associated fees for this service which are 2.5% + 15 cents (CAD) for all Credit Cards. AMEX is 3.5% + 30 cents (CAD). However, if you wish to cover the fees as well, you can click on the option to "Cover Fees".',style: TextStyle(

fontSize: 14,


),)
],

title: Row(
children: <Widget>[
Image.asset(
'images/online.png',
),
GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Online()),
);
},
child: Text(

'Online Giving',
style: TextStyle(
fontFamily: 'TT NORMS',
fontSize: 18,
fontWeight: FontWeight.w100,
color: _isExpandedonline ? Colors.amber[800] : Colors.black,

),


),

)

],


)),

),

Padding(
padding: EdgeInsets.only(left: 10),
child: ExpansionTile(
onExpansionChanged: (value) {
_isExpandedpaypal=value;
setState(() {});
},
children: <Widget>[
Text(
'You can send your funds through PayPal to email livinghopetv@cornerstoneasianchurch.com',style: TextStyle(
fontSize: 14,


),)
],
title: Row(
children: <Widget>[
Image.asset(
'images/paypal.png',
),
Padding(
padding: EdgeInsets.only(left: 10),
child: Text(
'PAYPAL',
style: TextStyle(

fontFamily: 'TT NORMS',
color:_isExpandedpaypal ? Colors.amber[800] : Colors.black,
fontSize: 18,
fontWeight: FontWeight.w100,
),
),
),
GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => paypal()),
);
},
child: Image.asset(
'images/donatebutton.png',
height: 33,
),
)
],
)),
),
Padding(
padding: EdgeInsets.only(left: 10),

child: ExpansionTile(
onExpansionChanged: (value) {
_isExpandedetransfer=value;
setState(() {});
},
children: <Widget>[
Text(
'You can send your funds via Interac E-Transfer to email*',style: TextStyle(
fontSize: 14,


),),

Text(
'
 cacoffering@gmail.com',
style: TextStyle(
color: Colors.blue,
fontSize: 18,

),
),

Text(
'
 This is an auto-deposit account
 so you you do not have to set up any password.
 Please do indicate the Purpose for your donation.
 This service is only available within Canada.',style: TextStyle(
fontSize: 14,


),),
],
title: Row(
children: <Widget>[
Image.asset(
'images/etransfer.png',
height: 28,
),
Text(
'INTERAC E-TRANSFER',
style: TextStyle(

fontFamily: 'TT NORMS',
fontSize: 18,
fontWeight: FontWeight.w100,
color:_isExpandedetransfer? Colors.amber[800] : Colors.black,

),
),
],
)),
),
Padding(
padding: EdgeInsets.only(left: 10),
child: ExpansionTile(
onExpansionChanged: (value) {
_isExpandedtexttogive=value;
setState(() {});
},
children: <Widget>[
Text('STEP 1: TEXT the word GIVE to',style: TextStyle(
fontSize: 14,


),),
Text(
'(844) 329-1637',
style: TextStyle(
color: Colors.red,
),
),
SizedBox(
height: 20,
),
Text(
'STEP 2: Complete the information on link received via TEXT for the first time only.',style:TextStyle(
fontSize: 14,


),),
SizedBox(
height: 20,
),
Text(
'STEP 3: Once you are setup for TEXT GIVING you can continue to TEXT the amount without having to fill your information again. Simply TEXT the amounti.e 10, 15 etc to the number directly.',style: TextStyle(
fontSize: 14,


),)
],
title: Row(
children: <Widget>[
Image.asset(
'images/text.png',
height: 30,
),
GestureDetector(
onTap: () {
customLaunch('sms:8443291637');
},
child: Padding(
padding: EdgeInsets.only(left: 10),
child: Text(
'TEXT TO GIVE',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w100,
fontFamily: 'TT NORMS',
color:_isExpandedtexttogive? Colors.amber[800] : Colors.black,

),
),
),
)
],
)),
),
],
),
),
),
),
),
);
}
}

最佳答案

问题是你不能在 child 中使用 Expand,这意味着一个 Expanded 小部件必须是一个后代或父,在 Debug模式下,你可以清楚地看到 Incorrect Usage of Parent Widget它将在 Debug模式下工作,但在发布版本中它将显示空白页,因此请注意上述警告或错误
不正确的用法

child: Container(
child:Expanded(
child: Column(
示例
Expanded(
child: Container(),
),
在行/列中
Row(
children: [
Expanded(
child: MyWidget(),
),
Expanded(
child:Text("Text Widget"),
),
],
)

关于Flutter 应用程序在发布应用程序模式下显示白屏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64586829/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com