import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Rein Demo'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int currentStep = 0;
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Stepper(
steps: [
Step(
title: const Text('テスト'),
subtitle: const Text('説明'),
content: Container(),
isActive: currentStep == 0,
),
Step(
title: const Text('回答'),
content: const Text('これはテストの内容です'),
isActive: currentStep == 1,
),
Step(
title: const Text('評価'),
content: const Text('あなた100点です'),
isActive: currentStep == 2,
),
],
onStepTapped: (index) {
setState(() {
currentStep = index;
});
},
currentStep: currentStep,
onStepCancel: () {
setState(() {
currentStep -= 1;
if (currentStep < 0) {
currentStep = 0;
}
});
},
onStepContinue: () {
setState(() {
currentStep += 1;
if (currentStep > 2) {
currentStep = 2;
}
});
},
),
),
);
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.