/
main.dart
67 lines (62 loc) · 1.82 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Copyright 2020 the Dart project authors.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'trees/controller_usage.dart';
import 'trees/tree_from_json.dart';
void main() {
runApp(Demo());
}
class Demo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: DefaultTabController(
length: 2,
child: Scaffold(
appBar: AppBar(
title: Text('flutter_simple_treeview Demo'),
actions: [
TextButton(
child: Text(
"Source Code",
style: TextStyle(color: Colors.white),
),
onPressed: () async => await launchUrl(
Uri.https('github.com',
'google/flutter.widgets/tree/master/packages/flutter_simple_treeview/example'),
)),
],
bottom: TabBar(
tabs: [
Tab(text: "Tree Controller Usage"),
Tab(text: "Tree From JSON"),
],
),
),
body: TabBarView(
children: [
buildBodyFrame(ControllerUsage()),
buildBodyFrame(TreeFromJson()),
],
),
),
),
);
}
/// Adds scrolling and padding to the [content].
Widget buildBodyFrame(Widget content) {
return SingleChildScrollView(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Padding(
padding: EdgeInsets.all(40),
child: content,
),
),
);
}
}