我想創建這樣的東西:-

我怎樣才能實作這些作為標簽欄的連接點布局。有沒有可用的軟體包?
uj5u.com熱心網友回復:
您可以使用此插件
uj5u.com熱心網友回復:
Stepper無需任何包即可在 Flutter 中創建Horizo??ntal
Container(
child: Column(
children: [
Expanded(
child: Stepper(
type: StepperType.horizontal,
physics: ScrollPhysics(),
currentStep: _stepNumber,
onStepTapped: (step) => onTapped(step),
onStepContinue: onContinued,
onStepCancel: onCancel,
steps: <Step>[
Step(
title: new Text(''),
content: Column(
children: <Widget>[
TextFormField(
decoration: InputDecoration(labelText: 'Email'),
),
TextFormField(
decoration: InputDecoration(labelText: 'Password'),
),
],
),
isActive: _stepNumber >= 0,
state: _stepNumber >= 0 ?
StepState.complete : StepState.disabled,
),
Step(
title: new Text(''),
content: Column(
children: <Widget>[
TextFormField(
decoration: InputDecoration(labelText: 'Home'),
),
TextFormField(
decoration: InputDecoration(labelText: 'Post Code'),
),
],
),
isActive: _stepNumber >= 0,
state: _stepNumber >= 1 ?
StepState.complete : StepState.disabled,
),
Step(
title: new Text(''),
content: Column(
children: <Widget>[
TextFormField(
decoration: InputDecoration(labelText: 'Number'),
),
],
),
isActive:_stepNumber >= 0,
state: _stepNumber >= 2 ?
StepState.complete : StepState.disabled,
),
Step(
title: new Text(''),
content: Column(
children: <Widget>[
TextFormField(
decoration: InputDecoration(labelText: 'Number'),
),
],
),
isActive:_stepNumber >= 0,
state: _stepNumber >= 3 ?
StepState.complete : StepState.disabled,
),
],
),
),
],
),
)
onTapped(int step){
setState(() => _stepNumber = step);
}
onContinued(){
_stepNumber < 3 ?
setState(() => _stepNumber = 1): null;
}
onCancel(){
_stepNumber > 0 ?
setState(() => _stepNumber -= 1) : null;
}
uj5u.com熱心網友回復:
檢查這個包:im_stepper,它有很多自定義選項。
uj5u.com熱心網友回復:
功能名稱是“步進器”,您可以使用很少的參考來實作這一點https://medium.flutterdevs.com/stepper-widget-in-flutter-37ce5b45575b這是如何在顫振和其他中使用步進器的教程說明我認為與您的 UI 設計非常相似的步進器可在https://stackoverflow.com/a/71656978/13497264上找到
這是簡單的步進器(cr:GeeksforGeeks)
class _MyHomePageState extends State<MyHomePage> {
// Here we have created list of steps that
// are required to complete the form
List<Step> stepList() => [
const Step(title: Text('Account'), content: Center(child: Text('Account'),)),
const Step(title: Text('Address'), content: Center(child: Text('Address'),)),
const Step(title: Text('Confirm'), content: Center(child: Text('Confirm'),))
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
backgroundColor: Colors.green,
title: const Text('GeeksforGeeks',style: TextStyle(color: Colors.white), ),
),
// Here we have initialized the stepper widget
body: Stepper(
steps: stepList(),
)
);
}
}
您可以通過將步進器設定為水平模式來將其設定為水平線:
body: Stepper(
type: StepperType.horizontal,
steps: stepList(),
)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/506288.html
