问题描述
我正在尝试在颤动网络中实现视差效果,并且已经跟踪了将效果引入其中的步骤,但似乎并没有像预期的那样反映在UI中。
我尝试添加所有必要的材料,但是效果没有显现出来。 我添加了所有定位的小部件,将变量声明为topOne和topTwo,并添加了通知侦听器。
这是我的代码段:
body: SingleChildScrollView(
child: NotificationListener(
onNotification: (v) {
if (v is ScrollUpdateNotification) {
setState(() {
topOne = topOne - v.scrollDelta / 3;
topTwo = topTwo - v.scrollDelta / 1;
});
}
},child: SafeArea(
child: Column(
children: [
Stack(
children: [
NavBar(
h: h / 1.2,w: w / 1,sel0: false,sel1: false,sel2: true,sel3: false,sel4: false,)
],),SizedBox(
height: h / 12,Container(
height: h / 1,width: w / 1,decoration: Boxdecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,end: Alignment.bottomCenter,colors: [
Colors.transparent,Colors.grey[100],AppColors.getWhite(),]),child: Stack(
children: [
Positioned(
top: 30,left: 30,child: Text(
'F L EX',style:
TextStyle(fontSize: 500,color: Colors.white),Positioned(
top: topOne,//I wanted this to move in the normal speed
left: 100,child: Container(
height: h / 1.1,width: w / 1.2,decoration: Boxdecoration(color: Colors.white,// borderRadius: BorderRadius.circular(8),BoxShadow: [
BoxShadow(
color: AppColors.getGrey(),blurRadius: 60.0,Positioned(
top: 80,left: 150,child: RotationTransition(
turns: new AlwaysstoppedAnimation(50 / 360),child: Container(
height: h / 6,width: w / 12,decoration: Boxdecoration(
border: Border.all(
color: AppColors.getGrey(),width: 4)),Positioned(
top: topTwo,// I wanted this to move slow than the above
left: 200,child: Text(
'WE DO IT ALL.',style: GoogleFonts.roboto(
fontSize: 30,fontWeight: FontWeight.normal,color: AppColors.getBlack()),
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)