andyduke / styled_text_package

Text widget with formatted text using tags. Makes it easier to use formatted text in multilingual applications.
https://pub.dev/packages/styled_text
BSD 3-Clause "New" or "Revised" License
74 stars 48 forks source link

fix styled text on Appbar #52

Closed srkrishnan1989 closed 2 years ago

srkrishnan1989 commented 2 years ago

fix styled text on Appbar while using NestedScrollView ,SliverAppBar,

issue is while using floating on SliverAppBar , when scrolling bottom to top, styled text disappear/not shown,

the code to reproduce the problem.

Scaffold(
      body: NestedScrollView(
        floatHeaderSlivers: true,
        headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
          return <Widget>[
            SliverAppBar(
              title: StyledText(
                text: '<b>Sample Items</b>',
                tags: {
                  'b': StyledTextTag(
                      style: const TextStyle(fontWeight: FontWeight.bold)),
                },
              ),
              snap: true,
              pinned: false,
              floating: true,
              actions: <Widget>[
                IconButton(
                  icon: const Icon(Icons.settings),
                  onPressed: () {

                    Navigator.restorablePushNamed(
                        context, SettingsView.routeName);
                  },
                ),
              ],
            ),
          ];
        },
        body:

            ListView.builder(

          restorationId: 'sampleItemListView',
          itemCount: items.length,
          itemBuilder: (BuildContext context, int index) {
            final item = items[index];

            return Column(
              children: [
                ListTile(
                    title: Text(
                      '''SampleItem ${item.id}
                  styled_text
                    styled_text_tag
                    styled_text_tag_action
                    styled_text_tag_base
                    styled_text_tag_custom
                    styled_text_tag_icon
                    styled_text_tag_widget
                    styled_text_tag_widget''',
                    ),

                    leading: const CircleAvatar(
                      foregroundImage:
                          AssetImage('assets/images/flutter_logo.png'),
                    ),
                    onTap: () {
                      Navigator.restorablePushNamed(
                        context,
                        SampleItemDetailsView.routeName,
                      );
                    }),
                const Divider(
                  color: Colors.grey,
                ),
              ],
            );
          },
        ),
      ),
    );

change items list length to 10 count,

run the app,

when scrolling bottom to top, styled text disappear/not shown,

when it reach top then only ,styled text appear/shown,

when trying same code Text widget , it shows Appbar text.

andyduke commented 2 years ago

@srkrishnan1989 Please provide minimal but complete code to reproduce the issue.

srkrishnan1989 commented 2 years ago

@srkrishnan1989 Please provide minimal but complete code to reproduce the issue.

create fresh app using "flutter create -t skeleton my_app"

just replace code on "sample_item_list_view.dart" file which previous given,

change items list length to 10 count, for scrolling effect.

srkrishnan1989 commented 2 years ago

I have attached screen recording , please check on Appbar,

https://user-images.githubusercontent.com/6891619/154808277-fb68dd93-d780-47e0-921f-c10e059efa55.mp4

https://user-images.githubusercontent.com/6891619/154808300-ac5e5b8e-3d12-47ae-95ed-1bb131962faf.mp4

andyduke commented 2 years ago

@srkrishnan1989 The problem is solved in the new version 5.0.0. Please check if this helped you.