GotJimmy / accordion

Other
47 stars 44 forks source link

ListController Keeps Refreshing Screen #37

Closed iDeveloper-CUSA closed 1 year ago

iDeveloper-CUSA commented 1 year ago

Flutter 3.3.9 • channel stable • https://github.com/flutter/flutter.git Framework • revision b8f7f1f986 (4 weeks ago) • 2022-11-23 06:43:51 +0900 Engine • revision 8f2221fbef Tools • Dart 2.18.5 • DevTools 2.15.0 Accordion 2.5.1

I have removed the accordion and replaced it with other content, and it does not cause the scren to flicker. However adding an Accordion with simple text header and column with text for content causes the screen to flicker. I have two separate screens that have the accordion that keep refreshing every 5 seconds. There are no separate streams being used as content on any of the content for each AccordionSection. As I stated, I replaced the Accordion children with a single AccordionSection with cont Text heaer and const Text content and still have the flickering.

The console continues with these messages every refresh.

[GETX] Instance "ListController" has been created with tag "552890119" [GETX] Instance "ListController" with tag "552890119" has been initialized

This only started happening since I updated Flutter and Accordion to the latest versions.

The code is below. The BookingDetails is a StatelessWidget which contains the Accordion.

manage_booking_screen.dart

import 'package:flutter/material.dart'; import 'package:guest_app_v4/components/booking_details/booking_details.dart'; import 'package:guest_app_v4/components/constants.dart'; import 'package:guest_app_v4/models/reservation_booking.dart'; import 'package:guest_app_v4/providers/app_provider.dart'; import 'package:provider/provider.dart';

class ManageBookingScreen extends StatefulWidget { static const id = "MANAGE_BOOKING_SCREEN"; final ReservationBooking booking;

const ManageBookingScreen({Key? key, required this.booking}) : super(key: key);

@override State createState() => _ManageBookingScreenState(); }

class _ManageBookingScreenState extends State { late final ReservationBooking booking;

@override void initState() { super.initState(); booking = widget.booking; }

@override Widget build(BuildContext context) { return Consumer( builder: (context, appProvider, child) => Scaffold( appBar: AppBar(title: const Text("Stay Details")), body: SafeArea( child: Container( height: double.infinity, width: double.infinity, decoration: BoxDecoration( image: DecorationImage( image: AssetImage( appProvider.deviceOrientation == 'portrait' ? 'assets/images/bg-porch-portrait.jpg' : 'assets/images/bg-porch-landscape.jpg', ), ), ), child: SingleChildScrollView( child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Padding( padding: const EdgeInsets.only( right: kSpacerSizeSmall, left: kSpacerSizeSmall, top: kSpacerSizeSmall, bottom: kSpacerSizeMedium, ), child: BookingDetails(booking), ), ], ), ), ), ), ), ); } }

booking_details.dart

import 'package:accordion/accordion.dart'; import 'package:flutter/material.dart'; import 'package:guest_app_v4/components/constants.dart'; import 'package:guest_app_v4/models/reservation_booking.dart';

class BookingDetails extends StatelessWidget { final ReservationBooking booking;

const BookingDetails(this.booking, {Key? key}) : super(key: key);

@override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.symmetric( horizontal: kSpacerSizeSmall, vertical: kSpacerSizeMedium, ), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Accordion( paddingListHorizontal: 0.0, paddingListBottom: 0.0, paddingListTop: 0.0, headerBackgroundColor: kCabinsUSABlue, headerPadding: const EdgeInsets.all(kSpacerSizeSmall * 1.5), contentBackgroundColor: kCabinsUSABlack, contentBorderColor: kCabinsUSABlack, paddingBetweenOpenSections: kSpacerSizeSmall, paddingBetweenClosedSections: kSpacerSizeSmall, disableScrolling: true, scaleWhenAnimating: false, maxOpenSections: 7, initialOpeningSequenceDelay: 0, children: [ AccordionSection( isOpen: true, header: const Text("Reservation Booking"), content: Column( children: [ Text(booking.rsvBookingNumber), ], ), ), ], ), ], ), ); } }

GotJimmy commented 1 year ago

Interesting. Which version of Accordion did you use when it was still working? Can you try that version of Accordion again to see if this still happens?

Have you changed anything else since (i.e.: causing repaints through setState)?

Never mind the "[GETX] Instance ..." messages, they're just standard debug messages from GetX.

iDeveloper-CUSA commented 1 year ago

Ignore this thread. It is me and not the module.