查找停用的小部件的祖先是不安全的。相关引起错误的小部件是消费者< ShowHomeProvider>

发布于 2025-01-23 06:32:37 字数 16893 浏览 0 评论 0原文

在更新了最新版本之后,当我推动MessuivisPage小部件时,Igot此错误:

FlutterError(查找停用的小部件的祖先是不安全的。 在这一点上,小部件的元素树状态不再稳定。 要安全地指在其dispose()方法中的小部件的祖先,请通过调用dideNInHeritedWidgetOfexacttype()在窗口小部件的didchangeDependencies()方法中保存对祖先的引用。

导航页面。

import 'package:bam_mobile/src/provider/animation_provider.dart';
import 'package:bam_mobile/src/provider/current_exlusive_code.dart';
import 'package:bam_mobile/src/provider/home_provider.dart';
import 'package:bam_mobile/src/provider/product_somme.dart';
import 'package:bam_mobile/src/provider/selected_agence_provider.dart';
import 'package:bam_mobile/src/provider/selected_embalage.dart';
import 'package:bam_mobile/src/provider/showHomeProvider.dart';
import 'package:bam_mobile/src/provider/showpages_provider.dart';
import 'package:bam_mobile/src/provider/tarif_provider.dart';
import 'package:bam_mobile/src/services/suivis_historic_status_handler.dart';
import 'package:bam_mobile/src/shared/global_context.dart';
import 'package:bam_mobile/src/shared/styles.dart';
import 'package:bam_mobile/src/ui/views/agences_page.dart';
import 'package:bam_mobile/src/ui/views/home_page.dart';
import 'package:bam_mobile/src/ui/views/mes_suivis_page.dart';
import 'package:bam_mobile/src/ui/views/promos_page.dart';
import 'package:bam_mobile/src/ui/views/spalsh_screen.dart';
import 'package:bam_mobile/src/ui/views/tarifs_page.dart';
import 'package:bam_mobile/src/ui/widgets/animation_navigation.dart';
import 'package:bam_mobile/src/ui/widgets/custom_app_bar.dart';
import 'package:bam_mobile/src/ui/widgets/custom_bottom_bar.dart';
import 'package:bam_mobile/src/ui/widgets/custom_floating_button.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'package:loading/indicator/ball_pulse_indicator.dart';
import 'package:loading/loading.dart';
import 'package:provider/provider.dart';

import 'config_size.dart';

class CustomNavigation extends StatefulWidget {


  final bool toSuivisHistorique;
  CustomNavigation({this.toSuivisHistorique = false});
  @override
  _CustomNavigationState createState() => _CustomNavigationState();
}

class _CustomNavigationState extends State<CustomNavigation>
    with TickerProviderStateMixin {


  TabController _tabController;
  AnimationController splashAnimationController;

  @override
  void initState() {
    super.initState();
    SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
    SystemChrome.setSystemUIOverlayStyle(
      SystemUiOverlayStyle(statusBarColor: Colors.transparent),
    );
    settingAnimtion();
    _tabController = TabController(vsync: this, length: 4);
    _tabController.addListener(listenToAnimation);
    gotoNextPage();

    WidgetsBinding.instance.addPostFrameCallback(initTabController);
    SuivisHistoricHandler historicHandler = new SuivisHistoricHandler();
    historicHandler.runHandler();
  }

  initTabController(_) {
    AnimationProvider animationProvider = Provider.of(context, listen: false);
    animationProvider.tabController = _tabController;
  }

  listenToAnimation() {
    if (_tabController.index == 2) setState(() {});
  }

  settingAnimtion() {
    splashAnimationController = AnimationController(
      vsync: this,
      duration: Duration(milliseconds: 1300),
    );
  }

  listenSplashAnimtion() {
    if (splashAnimationController.isCompleted) {
      SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
          overlays: SystemUiOverlay.values);
          splashAnimationController?.removeListener(listenSplashAnimtion);
          splashAnimationController?.dispose();
    }
  }

  @override
  dispose() {
    _tabController.dispose();
    super.dispose();
  }

  Future<void> gotoNextPage() async {
    await Future.delayed(Duration(seconds: 6));
    splashAnimationController.forward();
    splashAnimationController.addListener(listenSplashAnimtion);
  }

  @override
  Widget build(BuildContext context) {
    ConfigSize.init(context);
    ConfigSize.init(context);
    ScreenUtil.init(context, minTextAdapt: true, deviceSize: Size(414, 785));
    GlobalContext.init(context);
    print(MediaQuery.of(context).size.width);
    return Material(

      child: Stack(
        children: <Widget>[
          MultiProvider(
            providers: [
              ChangeNotifierProvider(
                create: (_) => SelectedEmbalageProvider(),
              ),
              ChangeNotifierProvider(
                create: (_) => TarifProvider(),
              ),
              ChangeNotifierProvider(
                create: (_) => ProductSomme(),
              ),
              ChangeNotifierProvider(
                create: (_) => CurrentExlusiveCodeProvider(),
              ),
              ChangeNotifierProvider(
                create: (_) => SelectedAgenceProvider(),
              ),
            ],
            child: WillPopScope(
              onWillPop: () async => false,
              child: Stack(
                children: <Widget>[
                  Scaffold(
                    backgroundColor: CustomColor.background,
                    body: Stack(
                      alignment: Alignment.bottomCenter,
                      children: <Widget>[
                        pages(),
                        Consumer<ShowPageProvider>(
                          builder: (_, status, __) {
                            return status.animationStatus ==
                                    AnimationStatus.forward
                                ? AnimatedContainer(
                                    duration: Duration(milliseconds: 400),
                                    decoration: BoxDecoration(
                                      gradient: status.animationStatus ==
                                              AnimationStatus.forward
                                          ? RadialGradient(
                                              colors: [
                                                Colors.black,
                                                Colors.transparent
                                                    .withOpacity(0.7),
                                              ],
                                              center:
                                                  FractionalOffset(0.5, 0.85),
                                            )
                                          : null,
                                    ),
                                  )
                                : SizedBox();
                          },
                        ),
                        Consumer<ShowPageProvider>(
                          builder: (_, provider, __) {
                            return provider.animationStatus ==
                                    AnimationStatus.dismissed
                                ? SizedBox()
                                : AnimationNavigation();
                          },
                        ),
                        MediaQuery.of(context).viewInsets.bottom > 0
                            ? SizedBox()
                            : CustomBottomBar(
                                tabController: _tabController,
                              ),
                        MediaQuery.of(context).viewInsets.bottom > 0
                            ? SizedBox()
                            : CustomFloatingButton(),
                      ],
                    ),
                  ),
                  Consumer<HomeProvider>(
                    builder: (_, HomeProvider homeProvider, __) {
                      if (homeProvider.musees.isEmpty ||
                          homeProvider.notificationsList.isEmpty)
                        return Container(
                          width: ScreenUtil().screenWidth,
                          height: ScreenUtil().screenHeight,
                          color: Colors.transparent.withOpacity(0.5),
                          child: Center(
                            child: Loading(
                              indicator: BallPulseIndicator(),
                              color: CustomColor.yellow,
                            ),
                          ),
                        );
                      return SizedBox();
                    },
                  ),
                ],
              ),
            ),
          ),
          AnimatedBuilder(
              animation: splashAnimationController,
              builder: (_, __) {
                print(splashAnimationController.value);
                return Transform.translate(
                  offset: Offset(
                    -ScreenUtil().screenWidth * splashAnimationController.value,
                    0,
                  ),
                  child: SplashScreen(),
                );
              }),
        ],
      ),
    );
  }

  SizedBox pages() {
    return SizedBox(
      height: (_tabController.index == 0 && ScreenUtil().screenHeight > 850)
          ? ScreenUtil().screenHeight * 1.35
          : ScreenUtil().screenHeight,
      child: Stack(
        children: <Widget>[
          Consumer<ShowHomeProvider>(
            builder: (_, provider, widget) {
              if (provider.showHome) return HomePage();
              return TabBarView(
                physics: NeverScrollableScrollPhysics(),
                controller: _tabController,
                children: <Widget>[
                  MesSuivisPage(),
                  PromosPage(),
                  TarifsPage(),
                  AgencesPage(),
                ],
              );
            },
          ),
          CustomAppBar(
            height: ScreenUtil().setSp(93),
            tabController: _tabController,
          ),
        ],
      ),
    );
  }
}

class AnimatedMenuItems {
  final String svg;
  final Color color;
  final String label;
  final double x;
  final double y;
  final int index;
  const AnimatedMenuItems(
      {this.x, this.y, this.label, this.svg, this.color, this.index});
}

const List<AnimatedMenuItems> animatedMenuItems = const [
  AnimatedMenuItems(
    label: "COURRIER",
    color: CustomColor.yellow,
    svg: "assets/icons/menu/courrier.svg",
    x: -36,
    y: 110,
    index: 0,
  ),
  AnimatedMenuItems(
    label: "COLIS",
    color: Color(0xffFF7600),
    svg: "assets/icons/menu/colis.svg",
    x: 37,
    y: 170,
    index: 1,
  ),
  AnimatedMenuItems(
    label: "NOS PRODUITS",
    color: Color(0xff46BA83),
    svg: "assets/icons/menu/produits.svg",
    x: 126,
    y: 197,
    index: 2,
  ),
  AnimatedMenuItems(
    label: "DIGITAL",
    color: Color(0xff2800E7),
    svg: "assets/icons/menu/digital.svg",
    x: 212,
    y: 170,
    index: 3,
  ),
];

这是 /strong>

════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown building Consumer<ShowHomeProvider>(dirty, dependencies: [_InheritedProviderScope<ShowHomeProvider?>]):
Looking up a deactivated widget's ancestor is unsafe.

At this point the state of the widget's element tree is no longer stable.

To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by calling dependOnInheritedWidgetOfExactType() in the widget's didChangeDependencies() method.

The relevant error-causing widget was
Consumer<ShowHomeProvider>
When the exception was thrown, this was the stack
#0      Element._debugCheckStateIsActiveForAncestorLookup.<anonymous closure>
#1      Element._debugCheckStateIsActiveForAncestorLookup
#2      Element.getElementForInheritedWidgetOfExactType
#3      debugCheckHasMediaQuery.<anonymous closure>
#4      debugCheckHasMediaQuery
#5      MediaQuery.of
#6      ScreenUtil.screenWidth
#7      ScreenUtil.scaleWidth
#8      ScreenUtil.scaleText
#9      ScreenUtil.setSp
#10     CustomBottomBar.build.<anonymous closure>
#11     Consumer.buildWithChild
#12     SingleChildStatelessWidget.build
#13     StatelessElement.build
#14     SingleChildStatelessElement.build
#15     ComponentElement.performRebuild
#16     Element.rebuild
#17     BuildOwner.buildScope
#18     WidgetsBinding.drawFrame
#19     RendererBinding._handlePersistentFrameCallback
#20     SchedulerBinding._invokeFrameCallback
#21     SchedulerBinding.handleDrawFrame
#22     SchedulerBinding._handleDrawFrame
#26     _invoke (dart:ui/hooks.dart:151:10)
#27     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:308:5)
#28     _drawFrame (dart:ui/hooks.dart:115:31)
(elided 3 frames from dart:async)
════════════════════════════════════════════════════════════════════════════════
Restarted application in 11 049ms.

════════ Exception caught by widgets library ═══════════════════════════════════
Looking up a deactivated widget's ancestor is unsafe.
The relevant error-causing widget was
Consumer<ShowHomeProvider>
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════
Looking up a deactivated widget's ancestor is unsafe.
The relevant error-causing widget was
Consumer<ShowHomeProvider>
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════
Looking up a deactivated widget's ancestor is unsafe.
The relevant error-causing widget was
MesSuivisPage
════════════════════════════════════════════════════════════════════════════════
I/flutter ( 6351): init called
I/flutter ( 6351): 411.42857142857144
I/flutter ( 6351): getNotification api entre d
I/flutter ( 6351): getProducts api entred
I/flutter ( 6351): init called
I/Choreographer( 6351): Skipped 88 frames!  The application may be doing too much work on its main thread.
I/flutter ( 6351): 0.0
I/flutter ( 6351): Entred getAgences : param null null
I/flutter ( 6351): getProduits api entred
I/flutter ( 6351): init called
I/OpenGLRenderer( 6351): Davey! duration=1767ms; Flags=1, IntendedVsync=21194800748633, Vsync=21194800748633, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=21194805459600, AnimationStart=21194805479500, PerformTraversalsStart=21194805506500, DrawStart=21196288226200, SyncQueued=21196288632200, SyncStart=21196289648100, IssueDrawCommandsStart=21196289828900, SwapBuffers=21196386491200, FrameCompleted=21196568869600, DequeueBufferDuration=275700, QueueBufferDuration=1393800, GpuCompleted=16410097190600,
I/flutter ( 6351): ********** the controller is intialized************
I/flutter ( 6351): AnimationProvider(_menuPositionValues: 0.0, _popPage: false, _pageContext: null, globalContext: null, _flareAnimation: remove_to_add, _flareAnimationCompleted: true, _animationController: null, initializeProvider: true, tabController: Instance of 'TabController')
I/flutter ( 6351): init called
I/flutter ( 6351): 411.42857142857144
I/flutter ( 6351): 0.0
I/flutter ( 6351): init called
I/flutter ( 6351): init called
I/flutter ( 6351): 0.0
I/flutter ( 6351): init called
I/flutter ( 6351): 0.2820923076923077
I/flutter ( 6351): init called
I/flutter ( 6351): 0.3589376923076923
I/flutter ( 6351): init called
I/flutter ( 6351): 0.39738615384615383
I/flutter ( 6351): init called
I/flutter ( 6351): 0.4486838461538461
I/flutter ( 6351): init called
I/flutter ( 6351): 0.5127876923076923
I/flutter ( 6351): init called
I/flutter ( 6351): 0.5513707692307692
I/flutter ( 6351): init called
I/flutter ( 6351): 0.60252
I/flutter ( 6351): init called
I/flutter ( 6351): 0.6410030769230769
I/flutter ( 6351): init called
I/flutter ( 6351): 0.6794476923076923
I/flutter ( 6351): init called
I/flutter ( 6351): 0.7050869230769231
I/flutter ( 6351): init called
I/flutter ( 6351): 0.7307615384615385
I/flutter ( 6351): init called
I/flutter ( 6351): 0.75639
I/flutter ( 6351): init called
I/flutter ( 6351): 0.7820484615384616
I/flutter ( 6351): init called
I/flutter ( 6351): 0.8076692307692308
I/flutter ( 6351): init called
I/flutter ( 6351): 0.8333638461538461
I/flutter ( 6351): init called
I/flutter ( 6351): 0.8589538461538462
I/flutter ( 6351): init called
I/flutter ( 6351): 0.8846107692307692
I/flutter ( 6351): init called
I/flutter ( 6351): 0.9230638461538462
I/flutter ( 6351): init called
I/flutter ( 6351): 0.9358830769230768
I/flutter ( 6351): init called
I/flutter ( 6351): 0.9743561538461539
I/flutter ( 6351): init called
I/flutter ( 6351): 0.9871830769230769
I/flutter ( 6351): init called
I/flutter ( 6351): 1.0
I/flutter ( 6351): init called
I/flutter ( 6351): init called
I/flutter ( 6351): 411.42857142857144
I/flutter ( 6351): 1.0
I/flutter ( 6351): init called
I/flutter ( 6351): init called

有人知道怎么了吗?

谢谢

After updating flutter to the latest version, when i push the MesSuivisPage widget, igot this error:

FlutterError (Looking up a deactivated widget's ancestor is unsafe.
At this point the state of the widget's element tree is no longer stable.
To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by calling dependOnInheritedWidgetOfExactType() in the widget's didChangeDependencies() method.)

This is the navigationpage:

import 'package:bam_mobile/src/provider/animation_provider.dart';
import 'package:bam_mobile/src/provider/current_exlusive_code.dart';
import 'package:bam_mobile/src/provider/home_provider.dart';
import 'package:bam_mobile/src/provider/product_somme.dart';
import 'package:bam_mobile/src/provider/selected_agence_provider.dart';
import 'package:bam_mobile/src/provider/selected_embalage.dart';
import 'package:bam_mobile/src/provider/showHomeProvider.dart';
import 'package:bam_mobile/src/provider/showpages_provider.dart';
import 'package:bam_mobile/src/provider/tarif_provider.dart';
import 'package:bam_mobile/src/services/suivis_historic_status_handler.dart';
import 'package:bam_mobile/src/shared/global_context.dart';
import 'package:bam_mobile/src/shared/styles.dart';
import 'package:bam_mobile/src/ui/views/agences_page.dart';
import 'package:bam_mobile/src/ui/views/home_page.dart';
import 'package:bam_mobile/src/ui/views/mes_suivis_page.dart';
import 'package:bam_mobile/src/ui/views/promos_page.dart';
import 'package:bam_mobile/src/ui/views/spalsh_screen.dart';
import 'package:bam_mobile/src/ui/views/tarifs_page.dart';
import 'package:bam_mobile/src/ui/widgets/animation_navigation.dart';
import 'package:bam_mobile/src/ui/widgets/custom_app_bar.dart';
import 'package:bam_mobile/src/ui/widgets/custom_bottom_bar.dart';
import 'package:bam_mobile/src/ui/widgets/custom_floating_button.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'package:loading/indicator/ball_pulse_indicator.dart';
import 'package:loading/loading.dart';
import 'package:provider/provider.dart';

import 'config_size.dart';

class CustomNavigation extends StatefulWidget {


  final bool toSuivisHistorique;
  CustomNavigation({this.toSuivisHistorique = false});
  @override
  _CustomNavigationState createState() => _CustomNavigationState();
}

class _CustomNavigationState extends State<CustomNavigation>
    with TickerProviderStateMixin {


  TabController _tabController;
  AnimationController splashAnimationController;

  @override
  void initState() {
    super.initState();
    SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
    SystemChrome.setSystemUIOverlayStyle(
      SystemUiOverlayStyle(statusBarColor: Colors.transparent),
    );
    settingAnimtion();
    _tabController = TabController(vsync: this, length: 4);
    _tabController.addListener(listenToAnimation);
    gotoNextPage();

    WidgetsBinding.instance.addPostFrameCallback(initTabController);
    SuivisHistoricHandler historicHandler = new SuivisHistoricHandler();
    historicHandler.runHandler();
  }

  initTabController(_) {
    AnimationProvider animationProvider = Provider.of(context, listen: false);
    animationProvider.tabController = _tabController;
  }

  listenToAnimation() {
    if (_tabController.index == 2) setState(() {});
  }

  settingAnimtion() {
    splashAnimationController = AnimationController(
      vsync: this,
      duration: Duration(milliseconds: 1300),
    );
  }

  listenSplashAnimtion() {
    if (splashAnimationController.isCompleted) {
      SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
          overlays: SystemUiOverlay.values);
          splashAnimationController?.removeListener(listenSplashAnimtion);
          splashAnimationController?.dispose();
    }
  }

  @override
  dispose() {
    _tabController.dispose();
    super.dispose();
  }

  Future<void> gotoNextPage() async {
    await Future.delayed(Duration(seconds: 6));
    splashAnimationController.forward();
    splashAnimationController.addListener(listenSplashAnimtion);
  }

  @override
  Widget build(BuildContext context) {
    ConfigSize.init(context);
    ConfigSize.init(context);
    ScreenUtil.init(context, minTextAdapt: true, deviceSize: Size(414, 785));
    GlobalContext.init(context);
    print(MediaQuery.of(context).size.width);
    return Material(

      child: Stack(
        children: <Widget>[
          MultiProvider(
            providers: [
              ChangeNotifierProvider(
                create: (_) => SelectedEmbalageProvider(),
              ),
              ChangeNotifierProvider(
                create: (_) => TarifProvider(),
              ),
              ChangeNotifierProvider(
                create: (_) => ProductSomme(),
              ),
              ChangeNotifierProvider(
                create: (_) => CurrentExlusiveCodeProvider(),
              ),
              ChangeNotifierProvider(
                create: (_) => SelectedAgenceProvider(),
              ),
            ],
            child: WillPopScope(
              onWillPop: () async => false,
              child: Stack(
                children: <Widget>[
                  Scaffold(
                    backgroundColor: CustomColor.background,
                    body: Stack(
                      alignment: Alignment.bottomCenter,
                      children: <Widget>[
                        pages(),
                        Consumer<ShowPageProvider>(
                          builder: (_, status, __) {
                            return status.animationStatus ==
                                    AnimationStatus.forward
                                ? AnimatedContainer(
                                    duration: Duration(milliseconds: 400),
                                    decoration: BoxDecoration(
                                      gradient: status.animationStatus ==
                                              AnimationStatus.forward
                                          ? RadialGradient(
                                              colors: [
                                                Colors.black,
                                                Colors.transparent
                                                    .withOpacity(0.7),
                                              ],
                                              center:
                                                  FractionalOffset(0.5, 0.85),
                                            )
                                          : null,
                                    ),
                                  )
                                : SizedBox();
                          },
                        ),
                        Consumer<ShowPageProvider>(
                          builder: (_, provider, __) {
                            return provider.animationStatus ==
                                    AnimationStatus.dismissed
                                ? SizedBox()
                                : AnimationNavigation();
                          },
                        ),
                        MediaQuery.of(context).viewInsets.bottom > 0
                            ? SizedBox()
                            : CustomBottomBar(
                                tabController: _tabController,
                              ),
                        MediaQuery.of(context).viewInsets.bottom > 0
                            ? SizedBox()
                            : CustomFloatingButton(),
                      ],
                    ),
                  ),
                  Consumer<HomeProvider>(
                    builder: (_, HomeProvider homeProvider, __) {
                      if (homeProvider.musees.isEmpty ||
                          homeProvider.notificationsList.isEmpty)
                        return Container(
                          width: ScreenUtil().screenWidth,
                          height: ScreenUtil().screenHeight,
                          color: Colors.transparent.withOpacity(0.5),
                          child: Center(
                            child: Loading(
                              indicator: BallPulseIndicator(),
                              color: CustomColor.yellow,
                            ),
                          ),
                        );
                      return SizedBox();
                    },
                  ),
                ],
              ),
            ),
          ),
          AnimatedBuilder(
              animation: splashAnimationController,
              builder: (_, __) {
                print(splashAnimationController.value);
                return Transform.translate(
                  offset: Offset(
                    -ScreenUtil().screenWidth * splashAnimationController.value,
                    0,
                  ),
                  child: SplashScreen(),
                );
              }),
        ],
      ),
    );
  }

  SizedBox pages() {
    return SizedBox(
      height: (_tabController.index == 0 && ScreenUtil().screenHeight > 850)
          ? ScreenUtil().screenHeight * 1.35
          : ScreenUtil().screenHeight,
      child: Stack(
        children: <Widget>[
          Consumer<ShowHomeProvider>(
            builder: (_, provider, widget) {
              if (provider.showHome) return HomePage();
              return TabBarView(
                physics: NeverScrollableScrollPhysics(),
                controller: _tabController,
                children: <Widget>[
                  MesSuivisPage(),
                  PromosPage(),
                  TarifsPage(),
                  AgencesPage(),
                ],
              );
            },
          ),
          CustomAppBar(
            height: ScreenUtil().setSp(93),
            tabController: _tabController,
          ),
        ],
      ),
    );
  }
}

class AnimatedMenuItems {
  final String svg;
  final Color color;
  final String label;
  final double x;
  final double y;
  final int index;
  const AnimatedMenuItems(
      {this.x, this.y, this.label, this.svg, this.color, this.index});
}

const List<AnimatedMenuItems> animatedMenuItems = const [
  AnimatedMenuItems(
    label: "COURRIER",
    color: CustomColor.yellow,
    svg: "assets/icons/menu/courrier.svg",
    x: -36,
    y: 110,
    index: 0,
  ),
  AnimatedMenuItems(
    label: "COLIS",
    color: Color(0xffFF7600),
    svg: "assets/icons/menu/colis.svg",
    x: 37,
    y: 170,
    index: 1,
  ),
  AnimatedMenuItems(
    label: "NOS PRODUITS",
    color: Color(0xff46BA83),
    svg: "assets/icons/menu/produits.svg",
    x: 126,
    y: 197,
    index: 2,
  ),
  AnimatedMenuItems(
    label: "DIGITAL",
    color: Color(0xff2800E7),
    svg: "assets/icons/menu/digital.svg",
    x: 212,
    y: 170,
    index: 3,
  ),
];

And This is the consol ouput:

════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown building Consumer<ShowHomeProvider>(dirty, dependencies: [_InheritedProviderScope<ShowHomeProvider?>]):
Looking up a deactivated widget's ancestor is unsafe.

At this point the state of the widget's element tree is no longer stable.

To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by calling dependOnInheritedWidgetOfExactType() in the widget's didChangeDependencies() method.

The relevant error-causing widget was
Consumer<ShowHomeProvider>
When the exception was thrown, this was the stack
#0      Element._debugCheckStateIsActiveForAncestorLookup.<anonymous closure>
#1      Element._debugCheckStateIsActiveForAncestorLookup
#2      Element.getElementForInheritedWidgetOfExactType
#3      debugCheckHasMediaQuery.<anonymous closure>
#4      debugCheckHasMediaQuery
#5      MediaQuery.of
#6      ScreenUtil.screenWidth
#7      ScreenUtil.scaleWidth
#8      ScreenUtil.scaleText
#9      ScreenUtil.setSp
#10     CustomBottomBar.build.<anonymous closure>
#11     Consumer.buildWithChild
#12     SingleChildStatelessWidget.build
#13     StatelessElement.build
#14     SingleChildStatelessElement.build
#15     ComponentElement.performRebuild
#16     Element.rebuild
#17     BuildOwner.buildScope
#18     WidgetsBinding.drawFrame
#19     RendererBinding._handlePersistentFrameCallback
#20     SchedulerBinding._invokeFrameCallback
#21     SchedulerBinding.handleDrawFrame
#22     SchedulerBinding._handleDrawFrame
#26     _invoke (dart:ui/hooks.dart:151:10)
#27     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:308:5)
#28     _drawFrame (dart:ui/hooks.dart:115:31)
(elided 3 frames from dart:async)
════════════════════════════════════════════════════════════════════════════════
Restarted application in 11 049ms.

════════ Exception caught by widgets library ═══════════════════════════════════
Looking up a deactivated widget's ancestor is unsafe.
The relevant error-causing widget was
Consumer<ShowHomeProvider>
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════
Looking up a deactivated widget's ancestor is unsafe.
The relevant error-causing widget was
Consumer<ShowHomeProvider>
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by widgets library ═══════════════════════════════════
Looking up a deactivated widget's ancestor is unsafe.
The relevant error-causing widget was
MesSuivisPage
════════════════════════════════════════════════════════════════════════════════
I/flutter ( 6351): init called
I/flutter ( 6351): 411.42857142857144
I/flutter ( 6351): getNotification api entre d
I/flutter ( 6351): getProducts api entred
I/flutter ( 6351): init called
I/Choreographer( 6351): Skipped 88 frames!  The application may be doing too much work on its main thread.
I/flutter ( 6351): 0.0
I/flutter ( 6351): Entred getAgences : param null null
I/flutter ( 6351): getProduits api entred
I/flutter ( 6351): init called
I/OpenGLRenderer( 6351): Davey! duration=1767ms; Flags=1, IntendedVsync=21194800748633, Vsync=21194800748633, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=21194805459600, AnimationStart=21194805479500, PerformTraversalsStart=21194805506500, DrawStart=21196288226200, SyncQueued=21196288632200, SyncStart=21196289648100, IssueDrawCommandsStart=21196289828900, SwapBuffers=21196386491200, FrameCompleted=21196568869600, DequeueBufferDuration=275700, QueueBufferDuration=1393800, GpuCompleted=16410097190600,
I/flutter ( 6351): ********** the controller is intialized************
I/flutter ( 6351): AnimationProvider(_menuPositionValues: 0.0, _popPage: false, _pageContext: null, globalContext: null, _flareAnimation: remove_to_add, _flareAnimationCompleted: true, _animationController: null, initializeProvider: true, tabController: Instance of 'TabController')
I/flutter ( 6351): init called
I/flutter ( 6351): 411.42857142857144
I/flutter ( 6351): 0.0
I/flutter ( 6351): init called
I/flutter ( 6351): init called
I/flutter ( 6351): 0.0
I/flutter ( 6351): init called
I/flutter ( 6351): 0.2820923076923077
I/flutter ( 6351): init called
I/flutter ( 6351): 0.3589376923076923
I/flutter ( 6351): init called
I/flutter ( 6351): 0.39738615384615383
I/flutter ( 6351): init called
I/flutter ( 6351): 0.4486838461538461
I/flutter ( 6351): init called
I/flutter ( 6351): 0.5127876923076923
I/flutter ( 6351): init called
I/flutter ( 6351): 0.5513707692307692
I/flutter ( 6351): init called
I/flutter ( 6351): 0.60252
I/flutter ( 6351): init called
I/flutter ( 6351): 0.6410030769230769
I/flutter ( 6351): init called
I/flutter ( 6351): 0.6794476923076923
I/flutter ( 6351): init called
I/flutter ( 6351): 0.7050869230769231
I/flutter ( 6351): init called
I/flutter ( 6351): 0.7307615384615385
I/flutter ( 6351): init called
I/flutter ( 6351): 0.75639
I/flutter ( 6351): init called
I/flutter ( 6351): 0.7820484615384616
I/flutter ( 6351): init called
I/flutter ( 6351): 0.8076692307692308
I/flutter ( 6351): init called
I/flutter ( 6351): 0.8333638461538461
I/flutter ( 6351): init called
I/flutter ( 6351): 0.8589538461538462
I/flutter ( 6351): init called
I/flutter ( 6351): 0.8846107692307692
I/flutter ( 6351): init called
I/flutter ( 6351): 0.9230638461538462
I/flutter ( 6351): init called
I/flutter ( 6351): 0.9358830769230768
I/flutter ( 6351): init called
I/flutter ( 6351): 0.9743561538461539
I/flutter ( 6351): init called
I/flutter ( 6351): 0.9871830769230769
I/flutter ( 6351): init called
I/flutter ( 6351): 1.0
I/flutter ( 6351): init called
I/flutter ( 6351): init called
I/flutter ( 6351): 411.42857142857144
I/flutter ( 6351): 1.0
I/flutter ( 6351): init called
I/flutter ( 6351): init called

Does anyone know what is wrong ?

Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文