Coder Social home page Coder Social logo

Comments (9)

jblankenship5 avatar jblankenship5 commented on August 11, 2024 2

This issue still exists, please reopen.

from flutter_sticky_headers.

toasterrrrr avatar toasterrrrr commented on August 11, 2024 1

@slightfoot is it possible to reopen this issue? Many thanks.

from flutter_sticky_headers.

am1tr0r avatar am1tr0r commented on August 11, 2024

@FlutterCommunityBot any solution for this issue?

from flutter_sticky_headers.

masbenx avatar masbenx commented on August 11, 2024

still waiting for the solution.. because i have the same issue..

from flutter_sticky_headers.

chrisynchen avatar chrisynchen commented on August 11, 2024

I can reproduce when entering to other page then go back. I believe it's same root cause.

from flutter_sticky_headers.

slightfoot avatar slightfoot commented on August 11, 2024

Can't replicate the issue on Flutter v3.0.0 and sticky_headers 0.3.0. Please retest and if it's still a problem provide example so we can resolve it.

from flutter_sticky_headers.

toasterrrrr avatar toasterrrrr commented on August 11, 2024

Hi, I'm currently experiencing the same issue mentioned above.
Currently on Flutter v3.3.6 and sticky_headers 0.3.0+2.

Here is the full code:

import 'package:flutter/material.dart';
import 'package:sticky_headers/sticky_headers.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final firstList = ['Hello', 'What is up?', 'You alright?'];
  final secondList = ['Bye', 'Adios'];
  final thirdList = ['Apple', 'Banana', 'Cherry', 'Durian', 'Figs'];

  @override
  Widget build(BuildContext context) {
    final combinedList = [firstList, secondList, thirdList];
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Column(
        children: [
          Expanded(
            child: Center(
              child: CustomScrollView(
                reverse: true,
                slivers: <Widget>[
                  SliverList(
                      delegate: SliverChildBuilderDelegate((context, index) {
                    return reversedMessageList(combinedList[index]);
                  }, childCount: combinedList.length)),
                ],
              ),
            ),
          ),
          TextField(
            style: Theme.of(context).textTheme.bodyText1,
            keyboardType: TextInputType.multiline,
            maxLines: 10,
            minLines: 1,
            textCapitalization: TextCapitalization.sentences,
            decoration: const InputDecoration(
              labelText: 'Message',
            ),
          ),
        ],
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {},
        child: const Icon(Icons.add),
      ),
    );
  }

  Widget reversedMessageList(List<String> messages) {
    //All messages sharing the same date, where date is displayed as StickyHeader
    return StickyHeader(
      overlapHeaders: false,
      content: Column(
        children: <Widget>[
          for (int i = 0; i < messages.length; i++)
            Container(
                decoration: const BoxDecoration(
                    color: Color(0xD9B2924A),
                    borderRadius: BorderRadius.all(Radius.circular(20))),
                child: Padding(
                    padding: const EdgeInsets.all(20),
                    child: Text(messages[i])))
        ],
      ),
      header: Padding(
          padding: const EdgeInsets.all(5),
          child: Center(
              child: Container(
                  decoration: const BoxDecoration(
                      color: Color(0xD9590E98),
                      borderRadius: BorderRadius.all(Radius.circular(20))),
                  child: Padding(
                      padding: const EdgeInsets.all(8),
                      child: Text('Number of messages ${messages.length}'))))),
    );
  }
}

22-11-15-22-32-52.mp4

from flutter_sticky_headers.

andynvt avatar andynvt commented on August 11, 2024

still exist

from flutter_sticky_headers.

amantoux avatar amantoux commented on August 11, 2024

A solution that works for me is to add WidgetsBindingObserver mixin to the widget encapsulating the list view, add it as an observer to WidgetsBinding.instance and implement didChangeMetrics as follows:

@override
void didChangeMetrics() {
  super.didChangeMetrics();
  setState(() {});
}

hope this helps

from flutter_sticky_headers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.