flutter - 小部件没有出现 - Flutter
问题描述
我正在使用AdvancedPageTurn
来自advanced_pa ge_turn 包的小部件。我将这个小部件包裹在 Scaffold body 属性中。该小部件完美地出现在模拟器上,但是当我在真实设备上启动应用程序时,该特定AdvancedPageTurn
小部件根本没有出现。
可能是什么问题呢?
class Lyrics extends StatefulWidget {
@override
_LyricsState createState() => _LyricsState();
}
class _LyricsState extends State<Lyrics> {
final _controller = GlobalKey<AdvancedPageTurnState>();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('App Title', style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontFamily: 'oswald'),),
centerTitle: true,
flexibleSpace: Image(
image: AssetImage('images/bg.jpg'),
fit: BoxFit.cover,
),
),
body: SafeArea(child: AdvancedPageTurn( // The Widget content is not appearing up at all but working fine on emulator
key: _controller,
initialIndex: 0,
children: [
Container(
decoration: BoxDecoration(
image: DecorationImage(image: AssetImage('images/bg.jpg'), fit: BoxFit.cover),
),
padding: EdgeInsets.all(25.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Title 1', style: TextStyle(fontSize: 28.0, height: 1.8, fontWeight: FontWeight.bold, color: Colors.white, fontFamily: 'oswald'), textAlign: TextAlign.center,),
],
),
),
Container(
decoration: BoxDecoration(
image: DecorationImage(image: AssetImage('images/bg.jpg'), fit: BoxFit.cover),
),
padding: EdgeInsets.all(25.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Title 2', style: TextStyle(fontSize: 28.0, height: 1.8, fontWeight: FontWeight.bold, color: Colors.white, fontFamily: 'oswald'), textAlign: TextAlign.center,),
],
),
),
],
),
),
);
}
}
解决方案
推荐阅读
- python - 使用 Matlab 中的 tensorflow-gpu 执行 python 时出现 DLL 错误
- makefile - 基于依赖通配符使用makefile生成目标子目录
- nativescript - sidedrawer.d.ts 中的 nativescript-ui-sidedrawer,找不到 TKView、TKTheme 等
- angular - 角度 - 检测通过单向绑定改变值
- c++ - 您将如何读取 GPU 的前端缓冲区以获取屏幕?
- c# - Null Coalescing Operator 比自己执行逻辑更快?
- python - 我不能将 if 语句与数学运算一起使用吗?
- python - pyinstall 不能使用选项 --noconsole
- drake - 可视化多个机器人的运动
- laravel - 如何在 MacOs 10.14 上设置工作虚拟主机?