Skip to content

Is AutoSizeGroup working within a pageview? #103

@desmeit

Description

@desmeit

Every time if I try to add a AutoSizeGroup to each child of an itembuilder of Pageview, it is loosing its state.
How ist the right way to add it?

final List<Widget> _pages = [
    OnboardingPage(
      color: Colors.blue,
      title: "title",
      subtitle: "subtitle",
      text: "the text,
      image: 'assets/svg/test.svg',
    ),

...

PageView.builder(
            controller: _controller,
            itemCount: _pages.length,
            itemBuilder: (context, position) {
              final page = Padding(
                padding: const EdgeInsets.symmetric(horizontal: 30),
                child: _pages[position],
              );

...

class OnboardingPage extends StatelessWidget {
  const OnboardingPage(
      {Key key,
      @required this.title,
      @required this.subtitle,
      @required this.text,
      @required this.color,
      @required this.image})
      : super(key: key);

  final String title;
  final String subtitle;
  final String text;
  final Color color;
  final String image;

@override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.stretch,
      children: <Widget>[
        SizedBox(
          height: 50,
        ),
        Padding(
          padding: const EdgeInsets.symmetric(horizontal: 30),
          child: AutoSizeText(title,
              textAlign: TextAlign.left,
              softWrap: false,
              maxLines: 1,
              minFontSize: 0,
              stepGranularity: 0.1,
              style: GoogleFonts.nunito(
                  fontSize: 40,
                  fontStyle: FontStyle.normal,
                  fontWeight: FontWeight.w800,
                  //letterSpacing: 0.8,
                  height: 1.0,
                  color: Colors.black87)),
        ),

...

I want the title of each element in the pageview to be the same size.

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions