Skip to content

Commit d307aa6

Browse files
committed
Started working on Example - break into smaller pieces, show code
1 parent d1f0341 commit d307aa6

File tree

5 files changed

+638
-567
lines changed

5 files changed

+638
-567
lines changed

example/lib/code_page.dart

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:widget_with_codeview/widget_with_codeview.dart';
3+
4+
class CodePage extends StatefulWidget {
5+
final String title;
6+
final Widget child;
7+
final String sourceFilePath;
8+
9+
const CodePage({
10+
Key key,
11+
@required this.title,
12+
@required this.child,
13+
@required this.sourceFilePath,
14+
}) : super(key: key);
15+
16+
@override
17+
_CodePageState createState() => _CodePageState();
18+
}
19+
20+
class _CodePageState extends State<CodePage> {
21+
@override
22+
Widget build(BuildContext context) {
23+
return Scaffold(
24+
appBar: AppBar(
25+
title: Text(widget.title),
26+
elevation: 0,
27+
),
28+
body: WidgetWithCodeView(
29+
child: widget.child,
30+
sourceFilePath: widget.sourceFilePath,
31+
// 1codeLinkPrefix` is optional. When it's specified, two more buttons
32+
// (open-code-in-browser, copy-code-link) will be added in the code view.
33+
// codeLinkPrefix: 'https://github.com/danvick/flutter_form_builder/blob/version_4/example/',
34+
),
35+
);
36+
}
37+
}

example/lib/home_page.dart

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import 'package:example/code_page.dart';
2+
import 'package:flutter/cupertino.dart';
3+
import 'package:flutter/material.dart';
4+
5+
import 'sources/complete_form.dart';
6+
7+
class HomePage extends StatelessWidget {
8+
@override
9+
Widget build(BuildContext context) {
10+
return Scaffold(
11+
appBar: AppBar(
12+
title: Text('Flutter Form Builder'),
13+
),
14+
body: ListView(
15+
children: <Widget>[
16+
ListTile(
17+
title: Text('Complete Form'),
18+
trailing: Icon(CupertinoIcons.right_chevron),
19+
onTap: () => Navigator.of(context)
20+
.push(MaterialPageRoute(builder: (context) => CodePage(
21+
title: 'Complete Form',
22+
child: CompleteForm(),
23+
sourceFilePath: 'lib/sources/complete_form.dart',
24+
))),
25+
),
26+
Divider(),
27+
],
28+
),
29+
);
30+
}
31+
}

0 commit comments

Comments
 (0)