fix:view code

This commit is contained in:
yifeng.yl
2019-02-03 00:33:58 +08:00
parent 95a54fed17
commit 8fb3560e21
5 changed files with 40 additions and 35 deletions

View File

@ -10,7 +10,6 @@
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
333E5DAE7FC10AC69FEC26C0 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DDA792F029EDD7A11295D192 /* libPods-Runner.a */; }; 333E5DAE7FC10AC69FEC26C0 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DDA792F029EDD7A11295D192 /* libPods-Runner.a */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
@ -41,7 +40,6 @@
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; }; 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
@ -92,7 +90,6 @@
children = ( children = (
3B80C3931E831B6300D905FE /* App.framework */, 3B80C3931E831B6300D905FE /* App.framework */,
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
9740EEBA1CF902C7004384FC /* Flutter.framework */, 9740EEBA1CF902C7004384FC /* Flutter.framework */,
9740EEB21CF90195004384FC /* Debug.xcconfig */, 9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
@ -209,7 +206,6 @@
files = ( files = (
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
); );

View File

@ -42,16 +42,23 @@ class _FullScreenCodeDialogState extends State<FullScreenCodeDialog> {
if (_exampleCode == null) { if (_exampleCode == null) {
body = const Center(child: CircularProgressIndicator()); body = const Center(child: CircularProgressIndicator());
} else { } else {
body = SingleChildScrollView( Widget _codeWidget;
child: Padding( try{
padding: const EdgeInsets.all(16.0), DartSyntaxHighlighter(style).format(_exampleCode);
child: RichText( _codeWidget = RichText(
text: TextSpan( text: TextSpan(
style: const TextStyle(fontFamily: 'monospace', fontSize: 10.0), style: const TextStyle(fontFamily: 'monospace', fontSize: 10.0),
children: <TextSpan>[ children: <TextSpan>[
DartSyntaxHighlighter(style).format(_exampleCode) DartSyntaxHighlighter(style).format(_exampleCode)
]), ],),
), );
}catch (err){
_codeWidget = Text(_exampleCode);
}
body = SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: _codeWidget,
), ),
); );
} }

View File

@ -1,7 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_go/components/widget_demo.dart'; import 'package:flutter_go/components/widget_demo.dart';
import 'demo.dart'; // import 'package:flutter_go/widgets/elements/Form/Text/RichText/demo.dart';
import './demo.dart';
const String intro = """ const String intro = """
### **简介** ### **简介**

View File

@ -1,9 +1,8 @@
/* /// @Author: 一凨
* @Author: 一凨 /// @Date: 2018-11-28 20:09:40
* @Date: 2018-11-28 20:09:40 /// @Last Modified by: 一凨
* @Last Modified by: 一凨 /// @Last Modified time: 2018-11-28 20:10:32
* @Last Modified time: 2018-11-28 20:10:32
*/
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class ExpandedDemo extends StatelessWidget { class ExpandedDemo extends StatelessWidget {
@ -14,57 +13,57 @@ class ExpandedDemo extends StatelessWidget {
return Column( return Column(
children: <Widget>[ children: <Widget>[
Text('Expanded'), Text('Expanded'),
new Row(children: <Widget>[ Row(children: <Widget>[
new RaisedButton( RaisedButton(
onPressed: () { onPressed: () {
print('点击红色按钮事件'); print('点击红色按钮事件');
}, },
color: const Color(0xffcc0000), color: const Color(0xffcc0000),
child: new Text('红色按钮',style: txtColor,), child: Text('红色按钮',style: txtColor,),
), ),
new Expanded( Expanded(
flex: 1,//flex用来设置当前可用空间的占优比 flex: 1,//flex用来设置当前可用空间的占优比
child: new RaisedButton( child: RaisedButton(
onPressed: () { onPressed: () {
print('点击黄色按钮事件'); print('点击黄色按钮事件');
}, },
color: const Color(0xfff1c232), color: const Color(0xfff1c232),
child: new Text('黄色按钮',style: txtColor,), child: Text('黄色按钮',style: txtColor,),
), ),
), ),
new RaisedButton( RaisedButton(
onPressed: () { onPressed: () {
print('点击粉色按钮事件'); print('点击粉色按钮事件');
}, },
color: const Color(0xffea9999), color: const Color(0xffea9999),
child: new Text('粉色按钮',style: txtColor,), child: Text('粉色按钮',style: txtColor,),
), ),
]), ]),
Text('Flexible'), Text('Flexible'),
new Row(children: <Widget>[ Row(children: <Widget>[
new RaisedButton( RaisedButton(
onPressed: () { onPressed: () {
print('点击红色按钮事件'); print('点击红色按钮事件');
}, },
color: const Color(0xffcc0000), color: const Color(0xffcc0000),
child: new Text('红色按钮',style: txtColor,), child: Text('红色按钮',style: txtColor,),
), ),
new Flexible( Flexible(
flex: 1, flex: 1,
child: new RaisedButton( child: RaisedButton(
onPressed: () { onPressed: () {
print('点击黄色按钮事件'); print('点击黄色按钮事件');
}, },
color: const Color(0xfff1c232), color: const Color(0xfff1c232),
child: new Text('黄色按钮',style: txtColor,), child: Text('黄色按钮',style: txtColor,),
), ),
), ),
new RaisedButton( RaisedButton(
onPressed: () { onPressed: () {
print('点击粉色按钮事件'); print('点击粉色按钮事件');
}, },
color: const Color(0xffea9999), color: const Color(0xffea9999),
child: new Text('粉色按钮',style: txtColor,), child: Text('粉色按钮',style: txtColor,),
), ),
]), ]),
], ],

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../../model/widget.dart';
import 'package:flutter_go/model/widget.dart';
import './Expanded/index.dart' as Expanded; import './Expanded/index.dart' as Expanded;