@@ -5,6 +5,8 @@ import 'package:dictionaries/src/preview.dart';
55import 'package:dictionaries/tabview.dart' ;
66import 'package:flutter/material.dart' ;
77
8+ const bool showSettings = false ;
9+
810enum DataType {
911 json,
1012 yaml,
@@ -69,7 +71,7 @@ class _ObjectEditorPageState extends State<ObjectEditorPage> with TickerProvider
6971 @override
7072 void initState () {
7173 root = widget.root;
72- tabs = [ObjectEditorTabType .base , ObjectEditorTabType .settings].map ((x) => UserFocusedTab <ObjectEditorTabType >(attachment: x, child: objectEditorTabTypeContent (context, x, root), thumbnail: objectEditorTabTypeToWidget (x), reorderable: false )).toList ();
74+ tabs = [ObjectEditorTabType .base , ObjectEditorTabType .settings].where ((x) => objectEditorTabTypeToWidget (x) != null ). map ((x) => UserFocusedTab <ObjectEditorTabType >(attachment: x, child: objectEditorTabTypeContent (context, x, root), thumbnail: objectEditorTabTypeToWidget (x)! , reorderable: false )).toList ();
7375 controller = UserFocusedTabViewController (tabs);
7476 super .initState ();
7577 }
@@ -112,7 +114,7 @@ class _ObjectEditorPageState extends State<ObjectEditorPage> with TickerProvider
112114 }, onSelected: (value) {
113115 if (value is DataType ) {
114116 var type = dataTypeToObjectEditorTabType (value);
115- controller! .addTab (UserFocusedTab (child: objectEditorTabTypeContent (context, type, root), thumbnail: objectEditorTabTypeToWidget (type), attachment: type, showCloseButton: true ));
117+ controller! .addTab (UserFocusedTab (child: objectEditorTabTypeContent (context, type, root), thumbnail: objectEditorTabTypeToWidget (type)! , attachment: type, showCloseButton: true ));
116118 }
117119 }),
118120 ),
@@ -124,13 +126,13 @@ class _ObjectEditorPageState extends State<ObjectEditorPage> with TickerProvider
124126 );
125127 }
126128
127- Widget objectEditorTabTypeToWidget (ObjectEditorTabType objectEditorTabType) {
129+ Widget ? objectEditorTabTypeToWidget (ObjectEditorTabType objectEditorTabType) {
128130 switch (objectEditorTabType) {
129131 case ObjectEditorTabType .base : return Icon (Icons .edit);
130132 case ObjectEditorTabType .json: return Text ("JSON" );
131133 case ObjectEditorTabType .yaml: return Text ("YAML" );
132134 case ObjectEditorTabType .plist: return Text ("PList" );
133- case ObjectEditorTabType .settings: return Icon (Icons .settings);
135+ case ObjectEditorTabType .settings: return showSettings ? Icon (Icons .settings) : null ;
134136 }
135137 }
136138
0 commit comments