Files
flame/tutorials/space_shooter/lib/widgets/step_scaffold.dart
Lukas Klingsbo 2a41d0d683 feat: Move to Flutter 3.0.0 and Dart 2.17.0 (#1713)
This upgrades all packages to Flutter 3.0.0 and fixes all analyze issues that came from that.
2022-06-08 06:04:40 +00:00

69 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:markdown/markdown.dart' as md;
import 'package:tutorials_space_shooter/widgets/code_block.dart';
class StepScaffold extends StatelessWidget {
final List<String> tutorial;
final Widget game;
const StepScaffold({
super.key,
required this.tutorial,
required this.game,
});
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 2,
child: Scaffold(
appBar: AppBar(
bottom: const TabBar(
tabs: [
Tab(text: 'Tutorial'),
Tab(text: 'Running example'),
],
),
),
body: TabBarView(
children: [
Padding(
padding: const EdgeInsets.all(22.0),
child: SingleChildScrollView(
child: Column(
children: tutorial.map(
(text) {
if (text.startsWith('```')) {
return CodeBlock(value: text);
} else {
return Align(
alignment: Alignment.topLeft,
child: MarkdownBody(
data: text,
selectable: true,
extensionSet: md.ExtensionSet(
md.ExtensionSet.gitHubFlavored.blockSyntaxes,
[
md.EmojiSyntax(),
...md
.ExtensionSet.gitHubFlavored.inlineSyntaxes,
],
),
),
);
}
},
).toList(),
),
),
),
game,
],
),
),
);
}
}