【发布时间】:2021-11-25 10:47:08
【问题描述】:
作为 Flutter 的初学者,我正在开发一个 Quotes 应用程序。所以我同时使用图像和文本来使这些 Quotes 在美学上更具吸引力。现在我想在我的应用程序的左下角添加一个简单的数字。它用于向用户显示他们现在所在的页面,无论我在做什么,都会向我显示错误。如果可能,请提供帮助。[这里 p1()、p2() 等是我创建的一些页面]
class OverviewScreen extends StatefulWidget {
const OverviewScreen({key, Key,}) : super(key: key);
@override
_OverviewScreenState createState() => _OverviewScreenState();
}
class _OverviewScreenState extends State<OverviewScreen> {
PageController pageController =PageController(initialPage: 0);
@override
Widget build(BuildContext context) {
return MaterialApp(
home:Scaffold(
drawer:NavigationDrawerWidget() ,
extendBodyBehindAppBar: true,
appBar: AppBar(
title: Text("Hu R Rehman",
style: TextStyle(fontFamily: "MonteCarlo"),),
centerTitle: true,
shape:RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(bottom: Radius.circular(16))
),
backgroundColor: Colors.transparent,
elevation: 0,
),
body:Center(
child: Stack(
alignment: Alignment.center,
children: [
PageView(
controller:pageController,
children: [
Stack(
alignment: Alignment.center,
children: [
Image(image: AssetImage('Image/soc1.jpg'),
fit: BoxFit.cover,
width: double.infinity,
height: double.infinity,),
const Text(' Hello world ',
style: TextStyle(
fontSize: 34.0,
fontFamily: "Explora",
color: Colors.white,
fontWeight: FontWeight.w900),
),
],
),
p1(),p2(), p3(), p5(),p6(),p4(),p7(),
p8()
],
)
],
),
)
),
);
}
}
【问题讨论】: