GeekyAnts / flutter-carousel

A carousel package in flutter with various configuration options
Other
66 stars 29 forks source link

The method 'updateRenderer' was called on null #5

Open ninjaasmoke opened 4 years ago

ninjaasmoke commented 4 years ago

The method 'updateRenderer' was called on null. Receiver: null Tried calling: updateRenderer(false)

Everytime I scroll between the widgets, I get this error.

Code:

`import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_multi_carousel/carousel.dart'; import 'package:flutter_story_app_concept/cardPage.dart';

class MyPage extends StatefulWidget { @override _MyPageState createState() => _MyPageState(); }

class _MyPageState extends State {

int initial = 2;

@override Widget build(BuildContext context) { return Container( decoration: BoxDecoration( gradient: LinearGradient( colors: [ Color(0xFF1b1e44), Color(0xff1b1e44), ], begin: Alignment.topCenter, end: Alignment.bottomCenter, tileMode: TileMode.clamp)), child: Scaffold( appBar: CupertinoNavigationBar( middle: Text("My Cards", style: TextStyle(color: Colors.white),), backgroundColor: Colors.transparent, ), backgroundColor: Colors.transparent, body: SingleChildScrollView( child: Column( children: [ SizedBox(height: 20,), SingleChildScrollView( scrollDirection: Axis.horizontal, padding: EdgeInsets.only(left: 20, right: 20), child: Row( children: [ Center( child: Hero( tag: 'dash', child: ClipRRect( borderRadius: BorderRadius.circular(20.0), child: Image.asset("assets/image_02.jpg", width: 296.0, height: 222.0), ), ), ), SizedBox(width: 20,), Center( child: ClipRRect( borderRadius: BorderRadius.circular(20.0), child: Container( padding: EdgeInsets.only(left: 20, top: 20), width: 296.0, height: 222.0, color: Colors.white, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text("Random Analytics", style: TextStyle(color: Colors.black, fontSize: 24, fontWeight: FontWeight.w500),), Text("Bla Bla Bla"), Text("\nGRAPH",style: TextStyle(fontWeight: FontWeight.bold, fontSize: 26),), Text("\nMore Text") ], ), alignment: Alignment.centerLeft, ) ), ), SizedBox(width: 20,), Center( child: ClipRRect( borderRadius: BorderRadius.circular(20.0), child: Container( padding: EdgeInsets.all(20), width: 296.0, height: 222.0, decoration: BoxDecoration( color: Colors.transparent, border: Border.all( color: Colors.red ), borderRadius: BorderRadius.circular(20) ), child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text("More Analytics", style: TextStyle(color: Colors.white, fontSize: 24, fontWeight: FontWeight.w500),), Text("Bla Bla Bla", style: TextStyle(color: Colors.white),), Container( decoration: BoxDecoration(borderRadius: BorderRadius.circular(30), color: Colors.green), height: 60, width: 60, ), Text("More Text",style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20, color: Colors.white)) ], ), alignment: Alignment.center, ) ), ), ], ), ), SizedBox(height: 30,), Container( child: Carousel( showIndicator: true, indicatorType: IndicatorTypes.dot, indicatorBackgroundOpacity: 0, allowWrap: false, height: MediaQuery.of(context).size.height.58, width: MediaQuery.of(context).size.width95, initialPage: initial, type: Types.slideSwiper, axis: Axis.horizontal, children: [ GestureDetector( onTap: () { Navigator.push( context, CupertinoPageRoute(builder: (BuildContext context) => CardPage( start: Colors.deepOrange[900], end: Colors.yellow[400], tag: 'num1', name: 'Nithin Sai', bank: 'Vijaya Bank', numb: '4432 5677 9812 0120', date: '02/23', ), fullscreenDialog: true ), ); setState(() { initial = 0; }); }, child: Hero( tag: 'num1', child: Container( padding: EdgeInsets.all(20), decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), gradient: LinearGradient( colors: [ Colors.deepOrange[900],Colors.yellow[400], ], begin: Alignment.topLeft, end: Alignment.bottomRight ) ), alignment: Alignment.topLeft, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text("Nithin Sai", style: TextStyle(fontSize: 40,color: Colors.white, fontWeight: FontWeight.bold, decoration: TextDecoration.none ), ), Text("\nVijaya Bank", style: TextStyle(fontSize: 30,color: Colors.grey[400], fontWeight: FontWeight.bold, decoration: TextDecoration.none ), ), ], ), ), flightShuttleBuilder: ( BuildContext flightContext, Animation animation, HeroFlightDirection flightDirection, BuildContext fromHeroContext, BuildContext toHeroContext, ) { final Hero toHero = toHeroContext.widget; return RotationTransition( turns: animation, child: toHero.child, ); }, ), ), GestureDetector( onTap: () { Navigator.push( context, CupertinoPageRoute(builder: (BuildContext context) => CardPage( start: Color(0xffe633e6), end: Color(0xff0000aa), tag: 'num2', name: 'Kashware', bank: 'ICICI Bank', numb: '4432 5209 9812 2314', date: '12/43', ), fullscreenDialog: true ), ); setState(() { initial = 1; }); }, child: Hero( tag: 'num2', child: Container( padding: EdgeInsets.all(20), decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), gradient: LinearGradient( colors: [ Color(0xffe633e6), Color(0xff0000aa) ], begin: Alignment.topLeft, end: Alignment.bottomRight ) ), alignment: Alignment.topLeft, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text("Kashware", style: TextStyle(fontSize: 40,color: Colors.white, fontWeight: FontWeight.bold, decoration: TextDecoration.none ), ), Text("\nICICI Bank", style: TextStyle(fontSize: 30,color: Colors.grey[400], fontWeight: FontWeight.bold, decoration: TextDecoration.none ), ), ], ), ), flightShuttleBuilder: ( BuildContext flightContext, Animation animation, HeroFlightDirection flightDirection, BuildContext fromHeroContext, BuildContext toHeroContext, ) { final Hero toHero = toHeroContext.widget; return RotationTransition( turns: animation, child: toHero.child, ); }, ), ), GestureDetector( onTap: () { Navigator.push( context, CupertinoPageRoute(builder: (BuildContext context) => CardPage( start: Colors.amber, end: Color(0xffaa0000), tag: 'num3', name: 'Random Person', bank: 'Bank Of Baroda', numb: '4577 0434 5678 9010', date: '06/28', ), fullscreenDialog: true ), ); setState(() { initial = 2; }); }, child: Hero( tag: 'num3', child: Container( padding: EdgeInsets.all(20), decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), gradient: LinearGradient( colors: [ Colors.amber, Color(0xffaa0000) ], begin: Alignment.topLeft, end: Alignment.bottomRight ) ), alignment: Alignment.topLeft, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text("Random Person", style: TextStyle(fontSize: 40,color: Colors.white, fontWeight: FontWeight.bold, decoration: TextDecoration.none ), ), Text("\nBank Of Baroda", style: TextStyle(fontSize: 30,color: Colors.grey[400], fontWeight: FontWeight.bold, decoration: TextDecoration.none ), ), ], ), ), flightShuttleBuilder: ( BuildContext flightContext, Animation animation, HeroFlightDirection flightDirection, BuildContext fromHeroContext, BuildContext toHeroContext, ) { final Hero toHero = toHeroContext.widget; return RotationTransition( turns: animation, child: toHero.child, ); }, ), ), GestureDetector( onTap: () { Navigator.push( context, CupertinoPageRoute(builder: (BuildContext context) => CardPage( start: Color(0xff4411ff), end: Colors.pink, tag: 'num4', name: 'Ranveer Singh', bank: 'HDFC Bank', numb: '1299 5630 7612 8710', date: '01/20', ), fullscreenDialog: true ), ); setState(() { initial = 3; }); }, child: Hero( tag: 'num4', child: Container( padding: EdgeInsets.all(20), decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), gradient: LinearGradient( colors: [ Color(0xff4411ff), Colors.pink ], begin: Alignment.topLeft, end: Alignment.bottomRight ) ), alignment: Alignment.topLeft, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text("Ranveer Singh", style: TextStyle(fontSize: 40,color: Colors.white, fontWeight: FontWeight.bold, decoration: TextDecoration.none ), ), Text("\nHDFC Bank", style: TextStyle(fontSize: 30,color: Colors.grey[400], fontWeight: FontWeight.bold, decoration: TextDecoration.none ), ), ], ), ), flightShuttleBuilder: ( BuildContext flightContext, Animation animation, HeroFlightDirection flightDirection, BuildContext fromHeroContext, BuildContext toHeroContext, ) { final Hero toHero = toHeroContext.widget; return RotationTransition( turns: animation, child: toHero.child, ); }, ), ), ], ), ), SizedBox(height: 20,), Center( child: Container( decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10) ), height: 100, width: MediaQuery.of(context).size.width-30, child: Text("Something Else", style: TextStyle(fontSize: 20),), alignment: Alignment.center, ) ), SizedBox(height: 20,) ], ), ), ), ); } }`

jaiswalshubham84 commented 4 years ago

Hi @ninjaasmoke , It will very helpful to debug this issue if you post any example code to replicate the issue.

ninjaasmoke commented 4 years ago

Hi @ninjaasmoke , It will very helpful to debug this issue if you post any example code to replicate the issue.

I have

zubairehman commented 4 years ago

getting the same issue