File tree Expand file tree Collapse file tree 5 files changed +638
-567
lines changed Expand file tree Collapse file tree 5 files changed +638
-567
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments