Skip to content

Instantly share code, notes, and snippets.

@Abhilash-Chandran
Created January 12, 2021 17:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Abhilash-Chandran/74d032d714f4dfea279743213c61c5f5 to your computer and use it in GitHub Desktop.
Save Abhilash-Chandran/74d032d714f4dfea279743213c61c5f5 to your computer and use it in GitHub Desktop.
FlutterStepper with ListView content.
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> {
int _currentStep = 0;
List<String> documents = ['file1.rst', 'file_2.txt', 'file_3.pdf'];
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'App',
home: new Scaffold(
appBar: new AppBar(title: new Text('App')),
body: new Stepper(
type: StepperType.vertical,
currentStep: _currentStep,
onStepTapped: (int step) => setState(() => _currentStep = step),
onStepContinue:
_currentStep < 2 ? () => setState(() => _currentStep += 1) : null,
onStepCancel:
_currentStep > 0 ? () => setState(() => _currentStep -= 1) : null,
steps: <Step>[
new Step(
title: new Text('Shipping'),
content: new Text('This is the first step.'),
isActive: _currentStep >= 0,
state:
_currentStep >= 0 ? StepState.complete : StepState.disabled,
),
new Step(
title: new Text('Payment'),
content: Column(
children: <Widget>[
ListView.builder(
shrinkWrap: true,
itemCount: documents.length,
itemBuilder: (context, index) {
final item = documents[index];
return ListTile(
title: Text("$item"),
);
},
),
Container(
child: MouseRegion(
child: GestureDetector(
child: Icon(
Icons.upload_file,
color: Colors.grey,
),
// onTap: () => {}
),
),
)
],
),
isActive: _currentStep >= 0,
state:
_currentStep >= 1 ? StepState.complete : StepState.disabled,
),
new Step(
title: new Text('Order'),
content: new Text('This is the third step.'),
isActive: _currentStep >= 0,
state:
_currentStep >= 2 ? StepState.complete : StepState.disabled,
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment