处理水平步进器溢出

Jen*_*ens 7 flutter

我用几个步骤实现了一个非常简单的水平步进器。但是,我收到溢出横幅,指出我的步骤不适合视图。

如何使带有可滚动步骤的栏?

import 'package:flutter/material.dart';

class SetupPage extends StatefulWidget {
  @override
  _SetupPageState createState() => _SetupPageState();
}

class _SetupPageState extends State<SetupPage> {

  List<Step> steps = [
    new Step(title: Text('Step 1'), content: new Container()),
    new Step(title: Text('Step 2'), content: new Container()),
    new Step(title: Text('Step 3'), content: new Container()),
    new Step(title: Text('Step 4'), content: new Container()),
    new Step(title: Text('Step 5'), content: new Container()),
    new Step(title: Text('Step 6'), content: new Container()),
    new Step(title: Text('Step 7'), content: new Container()),
  ];

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: AppBar(title: Text('Setup'),),
      body: new Stepper(steps: steps, type: StepperType.horizontal, currentStep: 0,),
    );
  }
}
Run Code Online (Sandbox Code Playgroud)

小智 3

我查看了步进器的源代码,它不处理其标题(带有步骤的栏)中的水平溢出。该scrollPhysics属性甚至没有在 _ 中使用buildHorizontal,该方法是在标题方向为水平时调用的构建标题的方法。

在撰写本文时,这似乎完全不受支持。我在 flutter github 页面上打开了一个问题,所以也许它会得到修复。