rand dart fix
This commit is contained in:
@@ -4,7 +4,6 @@ import 'tabs/master_detail_controller.dart';
|
|||||||
|
|
||||||
import 'tabs/table_view_controller.dart';
|
import 'tabs/table_view_controller.dart';
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
|
|
||||||
void main() => runApp(MyApp());
|
void main() => runApp(MyApp());
|
||||||
|
|
||||||
@@ -26,11 +25,11 @@ class CupertinoControllersApp extends StatelessWidget {
|
|||||||
items: [
|
items: [
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: Icon(Icons.list),
|
icon: Icon(Icons.list),
|
||||||
title: Text("Table"),
|
label: Text("Table"),
|
||||||
),
|
),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: Icon(Icons.layers),
|
icon: Icon(Icons.layers),
|
||||||
title: Text("Mater Detail"),
|
label: Text("Mater Detail"),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -41,9 +40,9 @@ class CupertinoControllersApp extends StatelessWidget {
|
|||||||
];
|
];
|
||||||
return CupertinoTabView(
|
return CupertinoTabView(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return pages[index]?.child;
|
return pages[index].child;
|
||||||
},
|
},
|
||||||
defaultTitle: pages[index]?.title,
|
defaultTitle: pages[index].title,
|
||||||
);
|
);
|
||||||
;
|
;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class TableViewScreenState extends State<TableViewScreen>
|
|||||||
var _sections = <CupertinoTableViewSection>[];
|
var _sections = <CupertinoTableViewSection>[];
|
||||||
|
|
||||||
_sections = _buildSections(context,
|
_sections = _buildSections(context,
|
||||||
data: _search != null && _search.isNotEmpty
|
data: _search.isNotEmpty
|
||||||
? _searchItems(context, search: _search)
|
? _searchItems(context, search: _search)
|
||||||
: contacts);
|
: contacts);
|
||||||
|
|
||||||
@@ -117,10 +117,9 @@ class TableViewScreenState extends State<TableViewScreen>
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
onChanged: (String value) {
|
onChanged: (String value) {
|
||||||
if (value != null)
|
setState(() {
|
||||||
setState(() {
|
_search = value;
|
||||||
_search = value;
|
});
|
||||||
});
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -144,17 +143,15 @@ class TableViewScreenState extends State<TableViewScreen>
|
|||||||
},
|
},
|
||||||
isEditing: _isEditing,
|
isEditing: _isEditing,
|
||||||
onEditing: (bool value) {
|
onEditing: (bool value) {
|
||||||
if (value != null) {
|
setState(() {
|
||||||
|
_isEditing = value;
|
||||||
|
});
|
||||||
|
if (!_isEditing) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isEditing = value;
|
selected.clear();
|
||||||
});
|
});
|
||||||
if (!_isEditing) {
|
|
||||||
setState(() {
|
|
||||||
selected.clear();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isSearching: _isSearching,
|
isSearching: _isSearching,
|
||||||
showEditingButtonLeft: true,
|
showEditingButtonLeft: true,
|
||||||
);
|
);
|
||||||
@@ -197,7 +194,7 @@ class TableViewScreenState extends State<TableViewScreen>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildListTile(BuildContext context, List<String> item) {
|
Widget _buildListTile(BuildContext context, List<String> item) {
|
||||||
final bool _selected = selected?.contains(item) ?? false;
|
final bool _selected = selected.contains(item) ?? false;
|
||||||
CupertinoEditingAction _action;
|
CupertinoEditingAction _action;
|
||||||
switch (sharedValue) {
|
switch (sharedValue) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ class CupertinoTableViewController extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return DefaultTextStyle(
|
return DefaultTextStyle(
|
||||||
style: Theme.of(context).textTheme.title!,
|
style: Theme.of(context).textTheme.titleLarge!,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
body: CustomScrollView(
|
body: CustomScrollView(
|
||||||
primary: true,
|
primary: true,
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
import '../../widgets/text.dart';
|
import '../../widgets/text.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,7 @@ class CupertinoSearchBar extends AnimatedWidget {
|
|||||||
this.onClear,
|
this.onClear,
|
||||||
this.enabled = true,
|
this.enabled = true,
|
||||||
this.autoCorrect = true,
|
this.autoCorrect = true,
|
||||||
}) : assert(controller != null),
|
}) : super(key: key, listenable: animation);
|
||||||
assert(focusNode != null),
|
|
||||||
super(key: key, listenable: animation);
|
|
||||||
|
|
||||||
final TextEditingController controller;
|
final TextEditingController controller;
|
||||||
final FocusNode focusNode;
|
final FocusNode focusNode;
|
||||||
@@ -68,7 +66,7 @@ class CupertinoSearchBar extends AnimatedWidget {
|
|||||||
style: new TextStyle(
|
style: new TextStyle(
|
||||||
inherit: false,
|
inherit: false,
|
||||||
color: CupertinoColors.inactiveGray
|
color: CupertinoColors.inactiveGray
|
||||||
.withOpacity(_opacityTween.evaluate(animation)),
|
.withValues(alpha: _opacityTween.evaluate(animation)),
|
||||||
fontSize: _kFontSize,
|
fontSize: _kFontSize,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -102,11 +100,10 @@ class CupertinoSearchBar extends AnimatedWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
new CupertinoButton(
|
new CupertinoButton(
|
||||||
minSize: 10.0,
|
|
||||||
padding: const EdgeInsets.all(1.0),
|
padding: const EdgeInsets.all(1.0),
|
||||||
borderRadius: new BorderRadius.circular(30.0),
|
borderRadius: new BorderRadius.circular(30.0),
|
||||||
color: CupertinoColors.inactiveGray.withOpacity(
|
color: CupertinoColors.inactiveGray.withValues(
|
||||||
1.0 - _opacityTween.evaluate(animation),
|
alpha: 1.0 - _opacityTween.evaluate(animation),
|
||||||
),
|
),
|
||||||
child: new Icon(
|
child: new Icon(
|
||||||
Icons.close,
|
Icons.close,
|
||||||
@@ -118,7 +115,7 @@ class CupertinoSearchBar extends AnimatedWidget {
|
|||||||
return;
|
return;
|
||||||
else
|
else
|
||||||
onClear!();
|
onClear!();
|
||||||
},
|
}, minimumSize: Size(10.0, 10.0),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
enum CupertinoTextTheme { title, subtitle, detail, custom }
|
enum CupertinoTextTheme { title, subtitle, detail, custom }
|
||||||
|
|||||||
@@ -168,11 +168,6 @@ class _UsesExampleState extends State<UsesExample> {
|
|||||||
),
|
),
|
||||||
body: Builder(
|
body: Builder(
|
||||||
builder: (_) {
|
builder: (_) {
|
||||||
if (_users == null) {
|
|
||||||
return Center(
|
|
||||||
child: CircularProgressIndicator(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (_users.isEmpty) {
|
if (_users.isEmpty) {
|
||||||
return Center(
|
return Center(
|
||||||
child: Text('No Users Found'),
|
child: Text('No Users Found'),
|
||||||
|
|||||||
@@ -49,9 +49,7 @@ class App {
|
|||||||
this.messagingSenderId,
|
this.messagingSenderId,
|
||||||
this.appId,
|
this.appId,
|
||||||
String? database,
|
String? database,
|
||||||
}) : _name = database,
|
}) : _name = database;
|
||||||
assert(apiKey != null),
|
|
||||||
assert(projectId != null);
|
|
||||||
|
|
||||||
factory App.fromJson(Map<String, dynamic> json) {
|
factory App.fromJson(Map<String, dynamic> json) {
|
||||||
return App(
|
return App(
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class FirestoreClientImpl extends FirestoreHttpClient {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<dynamic> sendHttpRequest(Uri uri,
|
Future<dynamic> sendHttpRequest(Uri uri,
|
||||||
{bool needsToken: true,
|
{bool needsToken = true,
|
||||||
String? extract,
|
String? extract,
|
||||||
Map<String, dynamic>? body}) async {
|
Map<String, dynamic>? body}) async {
|
||||||
var request = new HttpRequest();
|
var request = new HttpRequest();
|
||||||
|
|||||||
@@ -26,10 +26,6 @@ abstract class FirestoreHttpClient implements FirestoreClient {
|
|||||||
FirestoreAccessToken token;
|
FirestoreAccessToken token;
|
||||||
|
|
||||||
bool isCurrentTokenValid(bool refreshable) {
|
bool isCurrentTokenValid(bool refreshable) {
|
||||||
if (token == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (refreshable) {
|
if (refreshable) {
|
||||||
var now = DateTime.now();
|
var now = DateTime.now();
|
||||||
return token.expiresAt.difference(now).abs().inSeconds >= 60;
|
return token.expiresAt.difference(now).abs().inSeconds >= 60;
|
||||||
@@ -81,13 +77,11 @@ abstract class FirestoreHttpClient implements FirestoreClient {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
CollectionReference collection(String path) {
|
CollectionReference collection(String path) {
|
||||||
assert(path != null);
|
|
||||||
return CollectionReference(this, path.split('/'));
|
return CollectionReference(this, path.split('/'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
DocumentReference document(String path) {
|
DocumentReference document(String path) {
|
||||||
assert(path != null);
|
|
||||||
return DocumentReference(this, path.split('/'));
|
return DocumentReference(this, path.split('/'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,22 +93,22 @@ abstract class FirestoreHttpClient implements FirestoreClient {
|
|||||||
|
|
||||||
Future<Map<String, dynamic>?> getJsonMap(String url,
|
Future<Map<String, dynamic>?> getJsonMap(String url,
|
||||||
{Map<String, dynamic>? body,
|
{Map<String, dynamic>? body,
|
||||||
String? extract: "response",
|
String? extract = "response",
|
||||||
bool standard: true}) async {
|
bool standard = true}) async {
|
||||||
return (await sendHttpRequest(_apiUrl(url, standard),
|
return (await sendHttpRequest(_apiUrl(url, standard),
|
||||||
body: body, extract: extract)) as Map<String, dynamic>?;
|
body: body, extract: extract)) as Map<String, dynamic>?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<dynamic>?> getJsonList(String url,
|
Future<List<dynamic>?> getJsonList(String url,
|
||||||
{Map<String, dynamic>? body,
|
{Map<String, dynamic>? body,
|
||||||
String extract: "response",
|
String extract = "response",
|
||||||
bool standard: true}) async {
|
bool standard = true}) async {
|
||||||
return (await sendHttpRequest(_apiUrl(url, standard),
|
return (await sendHttpRequest(_apiUrl(url, standard),
|
||||||
body: body, extract: extract)) as List<dynamic>?;
|
body: body, extract: extract)) as List<dynamic>?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> sendHttpRequest(Uri uri,
|
Future<dynamic> sendHttpRequest(Uri uri,
|
||||||
{bool needsToken: true, String? extract, Map<String, dynamic>? body});
|
{bool needsToken = true, String? extract, Map<String, dynamic>? body});
|
||||||
|
|
||||||
Uri _apiUrl(String path, bool standard) {
|
Uri _apiUrl(String path, bool standard) {
|
||||||
path = standard ? "$path" : path;
|
path = standard ? "$path" : path;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class FirestoreClientImpl extends FirestoreHttpClient {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<dynamic> sendHttpRequest(Uri uri,
|
Future<dynamic> sendHttpRequest(Uri uri,
|
||||||
{bool needsToken: true,
|
{bool needsToken = true,
|
||||||
String? extract,
|
String? extract,
|
||||||
Map<String, dynamic>? body}) async {
|
Map<String, dynamic>? body}) async {
|
||||||
if (endpoints.enableProxyMode) {
|
if (endpoints.enableProxyMode) {
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ class DocumentReference implements FirestoreReference {
|
|||||||
/// Returns the reference of a collection contained inside of this
|
/// Returns the reference of a collection contained inside of this
|
||||||
/// document.
|
/// document.
|
||||||
CollectionReference collection(String collectionPath) {
|
CollectionReference collection(String collectionPath) {
|
||||||
assert(collectionPath != null);
|
|
||||||
return CollectionReference(client, <String>[path, collectionPath]);
|
return CollectionReference(client, <String>[path, collectionPath]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,8 @@ const List<String> _passwordEnvVars = const <String>[
|
|||||||
String? _getEnvKey(List<String> possible) {
|
String? _getEnvKey(List<String> possible) {
|
||||||
for (var key in possible) {
|
for (var key in possible) {
|
||||||
var dartEnvValue = new String.fromEnvironment(key);
|
var dartEnvValue = new String.fromEnvironment(key);
|
||||||
if (dartEnvValue != null) {
|
return dartEnvValue;
|
||||||
return dartEnvValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Platform.environment.containsKey(key) &&
|
if (Platform.environment.containsKey(key) &&
|
||||||
Platform.environment[key]!.isNotEmpty) {
|
Platform.environment[key]!.isNotEmpty) {
|
||||||
return Platform.environment[key];
|
return Platform.environment[key];
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class TabState extends ChangeNotifier {
|
|||||||
|
|
||||||
void changeTabOrder(List<String> _list) {
|
void changeTabOrder(List<String> _list) {
|
||||||
List<String> _tabs = _list;
|
List<String> _tabs = _list;
|
||||||
if (_tabs != null && _tabs.isNotEmpty) {
|
if (_tabs.isNotEmpty) {
|
||||||
List<DynamicTab> _newOrder = [];
|
List<DynamicTab> _newOrder = [];
|
||||||
for (var item in _tabs) {
|
for (var item in _tabs) {
|
||||||
_newOrder.add(_items!.firstWhere((t) => t.tag == item));
|
_newOrder.add(_items!.firstWhere((t) => t.tag == item));
|
||||||
@@ -92,14 +92,12 @@ class TabState extends ChangeNotifier {
|
|||||||
void _loadIndex() {
|
void _loadIndex() {
|
||||||
if (_persistIndex) {
|
if (_persistIndex) {
|
||||||
int _index = _storage.getInt(navKey);
|
int _index = _storage.getInt(navKey);
|
||||||
if (_index != null) {
|
if (_index > _maxTabs) {
|
||||||
if (_index > _maxTabs) {
|
_index = 0;
|
||||||
_index = 0;
|
|
||||||
}
|
|
||||||
_currentIndex = _index;
|
|
||||||
notifyListeners();
|
|
||||||
}
|
}
|
||||||
_saveIndex();
|
_currentIndex = _index;
|
||||||
|
notifyListeners();
|
||||||
|
_saveIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class GridTabItem extends StatelessWidget {
|
|||||||
feedback: DefaultTextStyle(
|
feedback: DefaultTextStyle(
|
||||||
style: adaptive && defaultTargetPlatform == TargetPlatform.iOS
|
style: adaptive && defaultTargetPlatform == TargetPlatform.iOS
|
||||||
? CupertinoTheme.of(context).textTheme.textStyle
|
? CupertinoTheme.of(context).textTheme.textStyle
|
||||||
: Theme.of(context).textTheme.title!,
|
: Theme.of(context).textTheme.titleLarge!,
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 120.0,
|
width: 120.0,
|
||||||
height: 80.0,
|
height: 80.0,
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class _EditScreenState extends State<EditScreen> {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
return DefaultTextStyle(
|
return DefaultTextStyle(
|
||||||
style: Theme.of(context).textTheme.display1!,
|
style: Theme.of(context).textTheme.headlineMedium!,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
@@ -118,7 +118,7 @@ class _EditScreenState extends State<EditScreen> {
|
|||||||
"Drag the icons to\norganize tabs.",
|
"Drag the icons to\norganize tabs.",
|
||||||
style: Theme.of(context)
|
style: Theme.of(context)
|
||||||
.textTheme
|
.textTheme
|
||||||
.headline4!
|
.headlineMedium!
|
||||||
.copyWith(fontSize: 22.0),
|
.copyWith(fontSize: 22.0),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
@@ -197,7 +197,7 @@ class _BottomEditableTabBarState extends State<BottomEditableTabBar> {
|
|||||||
// draggable: true,
|
// draggable: true,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
onWillAccept: (String? data) {
|
onWillAcceptWithDetails: (String? data) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_previewIndex = _targets.indexOf(t);
|
_previewIndex = _targets.indexOf(t);
|
||||||
});
|
});
|
||||||
@@ -208,7 +208,7 @@ class _BottomEditableTabBarState extends State<BottomEditableTabBar> {
|
|||||||
_previewIndex = null;
|
_previewIndex = null;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onAccept: (String data) {
|
onAcceptWithDetails: (String data) {
|
||||||
final DynamicTab _baseTab = _targets[_previewIndex!];
|
final DynamicTab _baseTab = _targets[_previewIndex!];
|
||||||
final DynamicTab _newTab = _tabs!.firstWhere((t) => t.tag == data);
|
final DynamicTab _newTab = _tabs!.firstWhere((t) => t.tag == data);
|
||||||
final int _oldIndex = _tabs!.indexOf(_newTab);
|
final int _oldIndex = _tabs!.indexOf(_newTab);
|
||||||
@@ -232,7 +232,7 @@ class _BottomEditableTabBarState extends State<BottomEditableTabBar> {
|
|||||||
child: Container(),
|
child: Container(),
|
||||||
tab: BottomNavigationBarItem(
|
tab: BottomNavigationBarItem(
|
||||||
icon: Icon(Icons.more_horiz),
|
icon: Icon(Icons.more_horiz),
|
||||||
title: Text("More"),
|
label: Text("More"),
|
||||||
),
|
),
|
||||||
tag: "",
|
tag: "",
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ class MaterialPage extends StatelessWidget {
|
|||||||
final i = model.extraTabs[index];
|
final i = model.extraTabs[index];
|
||||||
return ListTile(
|
return ListTile(
|
||||||
leading: i.tab.icon,
|
leading: i.tab.icon,
|
||||||
title: i.tab.title,
|
title: i.tab.label,
|
||||||
selected: expanded ? index == model.subIndex : false,
|
selected: expanded ? index == model.subIndex : false,
|
||||||
trailing:
|
trailing:
|
||||||
!expanded ? Icon(Icons.keyboard_arrow_right) : null,
|
!expanded ? Icon(Icons.keyboard_arrow_right) : null,
|
||||||
@@ -245,7 +245,7 @@ class CupertinoPage extends StatelessWidget {
|
|||||||
(BuildContext context, int index) {
|
(BuildContext context, int index) {
|
||||||
final i = model.extraTabs[index];
|
final i = model.extraTabs[index];
|
||||||
final Icon _icon = i.tab.icon as Icon;
|
final Icon _icon = i.tab.icon as Icon;
|
||||||
final Text _text = i.tab.title as Text;
|
final Text _text = i.tab.label as Text;
|
||||||
return DefaultTextStyle(
|
return DefaultTextStyle(
|
||||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||||
child: CupertinoListTile(
|
child: CupertinoListTile(
|
||||||
|
|||||||
@@ -63,19 +63,19 @@ class _EasyGoogleMapsState extends State<EasyGoogleMaps> {
|
|||||||
return EasyWebView(
|
return EasyWebView(
|
||||||
src: _src,
|
src: _src,
|
||||||
webAllowFullScreen: true,
|
webAllowFullScreen: true,
|
||||||
width: widget?.width,
|
width: widget.width,
|
||||||
height: widget?.height,
|
height: widget.height,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: widget?.width,
|
width: widget.width,
|
||||||
height: widget?.height,
|
height: widget.height,
|
||||||
child: FutureBuilder<List<Placemark>>(
|
child: FutureBuilder<List<Placemark>>(
|
||||||
future: geo.placemarkFromAddress(widget.address),
|
future: geo.placemarkFromAddress(widget.address),
|
||||||
builder: (_, snapshot) {
|
builder: (_, snapshot) {
|
||||||
if (snapshot.hasData) {
|
if (snapshot.hasData) {
|
||||||
final _place = snapshot?.data?.first;
|
final _place = snapshot.data?.first;
|
||||||
if (_place == null) {
|
if (_place == null) {
|
||||||
return Center(
|
return Center(
|
||||||
child: Text('Address not found!'),
|
child: Text('Address not found!'),
|
||||||
@@ -89,7 +89,7 @@ class _EasyGoogleMapsState extends State<EasyGoogleMaps> {
|
|||||||
markerId: MarkerId(widget.address.toString()),
|
markerId: MarkerId(widget.address.toString()),
|
||||||
position: _latLang,
|
position: _latLang,
|
||||||
infoWindow: InfoWindow(
|
infoWindow: InfoWindow(
|
||||||
title: widget?.title ?? '',
|
title: widget.title ?? '',
|
||||||
snippet: widget.address,
|
snippet: widget.address,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import 'package:easy_web_view/easy_web_view.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class BasicExample extends StatefulWidget {
|
class BasicExample extends StatefulWidget {
|
||||||
const BasicExample({Key? key}) : super(key: key);
|
const BasicExample({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_BasicExampleState createState() => _BasicExampleState();
|
_BasicExampleState createState() => _BasicExampleState();
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import 'package:async/async.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
class HtmlToPdfTest extends StatefulWidget {
|
class HtmlToPdfTest extends StatefulWidget {
|
||||||
const HtmlToPdfTest({Key? key}) : super(key: key);
|
const HtmlToPdfTest({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<HtmlToPdfTest> createState() => _HtmlToPdfTestState();
|
State<HtmlToPdfTest> createState() => _HtmlToPdfTestState();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import 'examples/html_to_pdf.dart';
|
|||||||
void main() => runApp(const MyApp());
|
void main() => runApp(const MyApp());
|
||||||
|
|
||||||
class MyApp extends StatefulWidget {
|
class MyApp extends StatefulWidget {
|
||||||
const MyApp({Key? key}) : super(key: key);
|
const MyApp({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<MyApp> createState() => _MyAppState();
|
State<MyApp> createState() => _MyAppState();
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class _MyAppState extends State<MyApp> {
|
|||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_auth.close();
|
_auth.close();
|
||||||
_userChanged?.cancel();
|
_userChanged.cancel();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,8 @@
|
|||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
void setTargetPlatformForDesktop({TargetPlatform platform}) {
|
void setTargetPlatformForDesktop({TargetPlatform platform}) {
|
||||||
TargetPlatform targetPlatform;
|
TargetPlatform targetPlatform;
|
||||||
if (platform != null) {
|
targetPlatform = platform;
|
||||||
targetPlatform = platform;
|
|
||||||
}
|
|
||||||
if (targetPlatform == null) {
|
|
||||||
if (Platform.isMacOS) {
|
|
||||||
targetPlatform = TargetPlatform.iOS;
|
|
||||||
} else if (Platform.isLinux || Platform.isWindows) {
|
|
||||||
targetPlatform = TargetPlatform.android;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
debugDefaultTargetPlatformOverride = targetPlatform;
|
debugDefaultTargetPlatformOverride = targetPlatform;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
final _user = await _auth.loginGoogle(
|
final _user = await _auth.loginGoogle(
|
||||||
idToken: event.idToken, accessToken: event.accessToken);
|
idToken: event.idToken, accessToken: event.accessToken);
|
||||||
if (_user != null) {
|
if (_user != null) {
|
||||||
if (saveUser != null) saveUser(_user);
|
saveUser(_user);
|
||||||
yield LoggedInState(_user);
|
yield LoggedInState(_user);
|
||||||
} else {
|
} else {
|
||||||
yield LoggedOutState();
|
yield LoggedOutState();
|
||||||
@@ -82,37 +82,25 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
Stream<AuthState> _mapGuestToState(LoginGuest event) async* {
|
Stream<AuthState> _mapGuestToState(LoginGuest event) async* {
|
||||||
yield AuthLoadingState();
|
yield AuthLoadingState();
|
||||||
final _user = await _auth.startAsGuest();
|
final _user = await _auth.startAsGuest();
|
||||||
if (_user != null) {
|
saveUser(_user);
|
||||||
if (saveUser != null) saveUser(_user);
|
yield LoggedInState(_user);
|
||||||
yield LoggedInState(_user);
|
|
||||||
} else {
|
|
||||||
yield LoggedOutState();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Stream<AuthState> _mapCheckToState(CheckUser event) async* {
|
Stream<AuthState> _mapCheckToState(CheckUser event) async* {
|
||||||
yield AuthLoadingState();
|
yield AuthLoadingState();
|
||||||
final _user = await _auth.currentUser();
|
final _user = await _auth.currentUser();
|
||||||
if (_user != null) {
|
saveUser(_user);
|
||||||
if (saveUser != null) saveUser(_user);
|
yield LoggedInState(_user);
|
||||||
yield LoggedInState(_user);
|
|
||||||
} else {
|
|
||||||
yield LoggedOutState();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Stream<AuthState> _mapCreateToState(CreateAccount event) async* {
|
Stream<AuthState> _mapCreateToState(CreateAccount event) async* {
|
||||||
yield AuthLoadingState();
|
yield AuthLoadingState();
|
||||||
try {
|
try {
|
||||||
AuthUser _user = await _auth.createAccount(event.username, event.password,
|
AuthUser _user = await _auth.createAccount(event.username, event.password,
|
||||||
displayName: event?.displayName, photoUrl: event?.photoUrl);
|
displayName: event.displayName, photoUrl: event.photoUrl);
|
||||||
if (_user != null) {
|
saveUser(_user);
|
||||||
if (saveUser != null) saveUser(_user);
|
yield LoggedInState(_user);
|
||||||
yield LoggedInState(_user);
|
} catch (e) {
|
||||||
} else {
|
|
||||||
yield AuthErrorState('Error creating user!');
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
yield AuthErrorState('Email already exists!');
|
yield AuthErrorState('Email already exists!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,18 +108,14 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
Stream<AuthState> _mapLoginToState(LoginEvent event) async* {
|
Stream<AuthState> _mapLoginToState(LoginEvent event) async* {
|
||||||
yield AuthLoadingState();
|
yield AuthLoadingState();
|
||||||
final _user = await _auth.login(event.username, event.password);
|
final _user = await _auth.login(event.username, event.password);
|
||||||
if (_user != null) {
|
saveUser(_user);
|
||||||
if (saveUser != null) saveUser(_user);
|
yield LoggedInState(_user);
|
||||||
yield LoggedInState(_user);
|
|
||||||
} else {
|
|
||||||
yield AuthErrorState('Username or Password Incorrect!');
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Stream<AuthState> _mapLogoutToState(LogoutEvent event) async* {
|
Stream<AuthState> _mapLogoutToState(LogoutEvent event) async* {
|
||||||
yield AuthLoadingState();
|
yield AuthLoadingState();
|
||||||
await _auth.logout();
|
await _auth.logout();
|
||||||
if (deleteUser != null) deleteUser();
|
deleteUser();
|
||||||
yield LoggedOutState();
|
yield LoggedOutState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,20 +126,16 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
Stream<AuthState> _mapEditInfoToState(EditInfo event) async* {
|
Stream<AuthState> _mapEditInfoToState(EditInfo event) async* {
|
||||||
yield AuthLoadingState();
|
yield AuthLoadingState();
|
||||||
await _auth.editInfo(
|
await _auth.editInfo(
|
||||||
displayName: event?.displayName, photoUrl: event?.photoUrl);
|
displayName: event.displayName, photoUrl: event.photoUrl);
|
||||||
final _user = await _auth.currentUser();
|
final _user = await _auth.currentUser();
|
||||||
if (saveUser != null) saveUser(_user);
|
saveUser(_user);
|
||||||
yield LoggedInState(_user);
|
yield LoggedInState(_user);
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<AuthState> _mapUpdateToState(UpdateUser event) async* {
|
Stream<AuthState> _mapUpdateToState(UpdateUser event) async* {
|
||||||
if (event?.user != null) {
|
saveUser(event.user);
|
||||||
if (saveUser != null) saveUser(event.user);
|
yield LoggedInState(event.user);
|
||||||
yield LoggedInState(event.user);
|
|
||||||
} else {
|
|
||||||
yield LoggedOutState();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Stream<AuthState> _mapForgotPasswordToState(ForgotPassword event) async* {
|
Stream<AuthState> _mapForgotPasswordToState(ForgotPassword event) async* {
|
||||||
await _auth.forgotPassword(event.email);
|
await _auth.forgotPassword(event.email);
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import 'dart:convert';
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import '../../classes/index.dart';
|
import '../../classes/index.dart';
|
||||||
import '../../utils/directory.dart';
|
|
||||||
import '../mobile/sdk.dart';
|
import '../mobile/sdk.dart';
|
||||||
import '../rest_api/client.dart';
|
import '../rest_api/client.dart';
|
||||||
import 'impl.dart';
|
import 'impl.dart';
|
||||||
@@ -35,12 +34,8 @@ class FBAuth implements FBAuthImpl {
|
|||||||
},
|
},
|
||||||
onSave: (data) async {
|
onSave: (data) async {
|
||||||
try {
|
try {
|
||||||
if (data == null) {
|
await _saveFile.writeAsString(json.encode(data));
|
||||||
await _saveFile.delete();
|
} catch (e) {}
|
||||||
} else {
|
|
||||||
await _saveFile.writeAsString(json.encode(data));
|
|
||||||
}
|
|
||||||
} catch (e) {}
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -50,10 +45,7 @@ class FBAuth implements FBAuthImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future _loadFile() async {
|
Future _loadFile() async {
|
||||||
if (_saveFile == null) {
|
|
||||||
final dir = await PathUtils.getDocumentDir();
|
|
||||||
_saveFile = File('${dir.path}/fb_auth.json');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get useClient => isDesktop || useRestClient;
|
bool get useClient => isDesktop || useRestClient;
|
||||||
|
|||||||
@@ -115,8 +115,8 @@ class FBAuth implements FBAuthImpl {
|
|||||||
Future editInfo({String displayName, String photoUrl}) async {
|
Future editInfo({String displayName, String photoUrl}) async {
|
||||||
final _user = _auth.currentUser;
|
final _user = _auth.currentUser;
|
||||||
final _info = UserProfile();
|
final _info = UserProfile();
|
||||||
if (displayName != null) _info.displayName = displayName;
|
_info.displayName = displayName;
|
||||||
if (photoUrl != null) _info.photoURL = photoUrl;
|
_info.photoURL = photoUrl;
|
||||||
try {
|
try {
|
||||||
await _user.updateProfile(_info);
|
await _user.updateProfile(_info);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -94,8 +94,8 @@ class FbSdk implements FBAuthImpl {
|
|||||||
Future editInfo({String displayName, String photoUrl}) async {
|
Future editInfo({String displayName, String photoUrl}) async {
|
||||||
final _user = await _auth.currentUser();
|
final _user = await _auth.currentUser();
|
||||||
final _info = UserUpdateInfo();
|
final _info = UserUpdateInfo();
|
||||||
if (displayName != null) _info.displayName = displayName;
|
_info.displayName = displayName;
|
||||||
if (photoUrl != null) _info.photoUrl = photoUrl;
|
_info.photoUrl = photoUrl;
|
||||||
try {
|
try {
|
||||||
await _user.updateProfile(_info);
|
await _user.updateProfile(_info);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -43,18 +43,16 @@ class FbClient implements FBAuthImpl {
|
|||||||
@override
|
@override
|
||||||
Future<AuthUser> currentUser() async {
|
Future<AuthUser> currentUser() async {
|
||||||
FirestoreJsonAccessToken token = await _loadToken();
|
FirestoreJsonAccessToken token = await _loadToken();
|
||||||
if (token != null) {
|
var result = await http.post(
|
||||||
var result = await http.post(
|
'https://identitytoolkit.googleapis.com/v1/accounts:lookup?key=${app.apiKey}',
|
||||||
'https://identitytoolkit.googleapis.com/v1/accounts:lookup?key=${app.apiKey}',
|
body: json.encode({
|
||||||
body: json.encode({
|
"idToken": token.idToken,
|
||||||
"idToken": token?.idToken,
|
"returnSecureToken": true,
|
||||||
"returnSecureToken": true,
|
}),
|
||||||
}),
|
);
|
||||||
);
|
token = await _saveToken(result);
|
||||||
token = await _saveToken(result);
|
return _getUser(token);
|
||||||
return _getUser(token);
|
return null;
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -63,16 +61,15 @@ class FbClient implements FBAuthImpl {
|
|||||||
final result = await http.post(
|
final result = await http.post(
|
||||||
'https://identitytoolkit.googleapis.com/v1/accounts:update?key=${app.apiKey}',
|
'https://identitytoolkit.googleapis.com/v1/accounts:update?key=${app.apiKey}',
|
||||||
body: json.encode({
|
body: json.encode({
|
||||||
"idToken": token?.idToken,
|
"idToken": token.idToken,
|
||||||
if (displayName != null) ...{
|
...{
|
||||||
'displayName': displayName,
|
'displayName': displayName,
|
||||||
},
|
},
|
||||||
if (photoUrl != null) ...{
|
...{
|
||||||
'photoUrl': photoUrl,
|
'photoUrl': photoUrl,
|
||||||
},
|
},
|
||||||
"deleteAttribute": [
|
"deleteAttribute": [
|
||||||
if (displayName == null) 'DISPLAY_NAME',
|
|
||||||
if (photoUrl == null) 'PHOTO_URL',
|
|
||||||
],
|
],
|
||||||
"returnSecureToken": true,
|
"returnSecureToken": true,
|
||||||
}),
|
}),
|
||||||
@@ -126,7 +123,7 @@ class FbClient implements FBAuthImpl {
|
|||||||
var result = await http.post(
|
var result = await http.post(
|
||||||
'https://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key=${app.apiKey}',
|
'https://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key=${app.apiKey}',
|
||||||
body: json.encode({
|
body: json.encode({
|
||||||
"idToken": token?.idToken,
|
"idToken": token.idToken,
|
||||||
"requestType": 'VERIFY_EMAIL',
|
"requestType": 'VERIFY_EMAIL',
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@@ -169,12 +166,12 @@ class FbClient implements FBAuthImpl {
|
|||||||
final _user = FirebaseUser(item, token.idToken);
|
final _user = FirebaseUser(item, token.idToken);
|
||||||
if (_user.uid == token.localId) {
|
if (_user.uid == token.localId) {
|
||||||
final _auth = AuthUser(
|
final _auth = AuthUser(
|
||||||
displayName: _user?.displayName,
|
displayName: _user.displayName,
|
||||||
email: _user?.email,
|
email: _user.email,
|
||||||
isAnonymous: _user?.isAnonymous ?? true,
|
isAnonymous: _user.isAnonymous ?? true,
|
||||||
isEmailVerified: _user?.isEmailVerified ?? false,
|
isEmailVerified: _user.isEmailVerified ?? false,
|
||||||
photoUrl: _user.photoUrl,
|
photoUrl: _user.photoUrl,
|
||||||
uid: _user?.uid,
|
uid: _user.uid,
|
||||||
);
|
);
|
||||||
_onAuthChanged.add(_auth);
|
_onAuthChanged.add(_auth);
|
||||||
return _auth;
|
return _auth;
|
||||||
@@ -185,11 +182,9 @@ class FbClient implements FBAuthImpl {
|
|||||||
|
|
||||||
Future<FirestoreJsonAccessToken> _loadToken() async {
|
Future<FirestoreJsonAccessToken> _loadToken() async {
|
||||||
final _data = await onLoad();
|
final _data = await onLoad();
|
||||||
if (_data != null) {
|
final token = FirestoreJsonAccessToken(_data, DateTime.now());
|
||||||
final token = FirestoreJsonAccessToken(_data, DateTime.now());
|
return token;
|
||||||
return token;
|
return null;
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class FirebaseUser {
|
|||||||
}).toList();
|
}).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get isAnonymous => email == null || email.isEmpty;
|
bool get isAnonymous => email.isEmpty;
|
||||||
|
|
||||||
bool get isEmailVerified => json['emailVerified'];
|
bool get isEmailVerified => json['emailVerified'];
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:fb_firestore/fb_firestore.dart';
|
import 'package:fb_firestore/fb_firestore.dart';
|
||||||
|
|
||||||
void main() => runApp(MyApp());
|
void main() => runApp(MyApp());
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'$_counter',
|
'$_counter',
|
||||||
style: Theme.of(context).textTheme.headline4,
|
style: Theme.of(context).textTheme.headlineMedium,
|
||||||
),
|
),
|
||||||
FeatureBuilder(
|
FeatureBuilder(
|
||||||
feature: _counterFeature,
|
feature: _counterFeature,
|
||||||
|
|||||||
@@ -9,13 +9,11 @@ import 'package:image_picker/image_picker.dart';
|
|||||||
|
|
||||||
Future<FileX> openFile() async {
|
Future<FileX> openFile() async {
|
||||||
final _files = await _open(false, false);
|
final _files = await _open(false, false);
|
||||||
if (_files == null) return null;
|
|
||||||
return _files.first;
|
return _files.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<FileX>> openFiles() async {
|
Future<List<FileX>> openFiles() async {
|
||||||
final _files = await _open(true, false);
|
final _files = await _open(true, false);
|
||||||
if (_files == null) return null;
|
|
||||||
return _files;
|
return _files;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,7 +28,7 @@ Future<FileX> pickImage() async {
|
|||||||
fileExtensions: kImageExtensions,
|
fileExtensions: kImageExtensions,
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
if (_files == null || _files.isEmpty) return null;
|
if (_files.isEmpty) return null;
|
||||||
return _files.first;
|
return _files.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +43,7 @@ Future<FileX> pickVideo() async {
|
|||||||
fileExtensions: kVideoExtensions,
|
fileExtensions: kVideoExtensions,
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
if (_files == null || _files.isEmpty) return null;
|
if (_files.isEmpty) return null;
|
||||||
return _files.first;
|
return _files.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,13 +66,11 @@ Future<List<FileX>> _open(bool multiple, bool folders,
|
|||||||
final List<FileX> _files = [];
|
final List<FileX> _files = [];
|
||||||
if (multiple) {
|
if (multiple) {
|
||||||
List<File> files = await FilePicker.getMultiFile();
|
List<File> files = await FilePicker.getMultiFile();
|
||||||
if (files == null) return null;
|
|
||||||
for (final file in files) {
|
for (final file in files) {
|
||||||
_files.add(await _add(file));
|
_files.add(await _add(file));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
File file = await FilePicker.getFile();
|
File file = await FilePicker.getFile();
|
||||||
if (file == null) return null;
|
|
||||||
_files.add(await _add(file));
|
_files.add(await _add(file));
|
||||||
}
|
}
|
||||||
return _files;
|
return _files;
|
||||||
|
|||||||
@@ -6,31 +6,30 @@ import 'dart:html' as html;
|
|||||||
|
|
||||||
Future<FileX> pickImage() async {
|
Future<FileX> pickImage() async {
|
||||||
final _files = await _open(false, false, 'image/*');
|
final _files = await _open(false, false, 'image/*');
|
||||||
if (_files == null || _files.isEmpty) return null;
|
if (_files.isEmpty) return null;
|
||||||
return _files.first;
|
return _files.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<FileX> pickVideo() async {
|
Future<FileX> pickVideo() async {
|
||||||
final _files = await _open(false, false, 'video/*');
|
final _files = await _open(false, false, 'video/*');
|
||||||
if (_files == null || _files.isEmpty) return null;
|
if (_files.isEmpty) return null;
|
||||||
return _files.first;
|
return _files.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<FileX> pickAudio() async {
|
Future<FileX> pickAudio() async {
|
||||||
final _files = await _open(false, false, 'audio/*');
|
final _files = await _open(false, false, 'audio/*');
|
||||||
if (_files == null || _files.isEmpty) return null;
|
if (_files.isEmpty) return null;
|
||||||
return _files.first;
|
return _files.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<FileX> openFile() async {
|
Future<FileX> openFile() async {
|
||||||
final _files = await _open(false, false);
|
final _files = await _open(false, false);
|
||||||
if (_files == null || _files.isEmpty) return null;
|
if (_files.isEmpty) return null;
|
||||||
return _files.first;
|
return _files.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<FileX>> openFiles() async {
|
Future<List<FileX>> openFiles() async {
|
||||||
final _files = await _open(true, false);
|
final _files = await _open(true, false);
|
||||||
if (_files == null) return null;
|
|
||||||
return _files;
|
return _files;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +45,6 @@ Future<List<FileX>> _open(bool multiple, bool folders,
|
|||||||
}
|
}
|
||||||
_upload.click();
|
_upload.click();
|
||||||
final _file = await _upload.onChange.first;
|
final _file = await _upload.onChange.first;
|
||||||
if (_file == null) return null;
|
|
||||||
List<html.File> files = (_file.target as dynamic).files;
|
List<html.File> files = (_file.target as dynamic).files;
|
||||||
final List<FileX> _files = [];
|
final List<FileX> _files = [];
|
||||||
for (final f in files) {
|
for (final f in files) {
|
||||||
|
|||||||
@@ -25,9 +25,7 @@ void _setTargetPlatformForDesktop() {
|
|||||||
} else if (Platform.isLinux || Platform.isWindows) {
|
} else if (Platform.isLinux || Platform.isWindows) {
|
||||||
targetPlatform = TargetPlatform.android;
|
targetPlatform = TargetPlatform.android;
|
||||||
}
|
}
|
||||||
if (targetPlatform != null) {
|
debugDefaultTargetPlatformOverride = targetPlatform;
|
||||||
debugDefaultTargetPlatformOverride = targetPlatform;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatefulWidget {
|
class MyApp extends StatefulWidget {
|
||||||
|
|||||||
@@ -19,11 +19,7 @@ class SliverFloatingBar extends StatefulWidget {
|
|||||||
this.floating = false,
|
this.floating = false,
|
||||||
this.pinned = false,
|
this.pinned = false,
|
||||||
this.snap = false,
|
this.snap = false,
|
||||||
}) : assert(automaticallyImplyLeading != null),
|
}) : assert(floating || !snap,
|
||||||
assert(floating != null),
|
|
||||||
assert(pinned != null),
|
|
||||||
assert(snap != null),
|
|
||||||
assert(floating || !snap,
|
|
||||||
'The "snap" argument only makes sense for floating app bars.'),
|
'The "snap" argument only makes sense for floating app bars.'),
|
||||||
super(key: key);
|
super(key: key);
|
||||||
|
|
||||||
@@ -224,35 +220,28 @@ class _FloatingAppBarState extends State<_FloatingAppBar> {
|
|||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
if (_position != null)
|
_position.isScrollingNotifier.removeListener(_isScrollingListener);
|
||||||
_position.isScrollingNotifier.removeListener(_isScrollingListener);
|
_position = Scrollable.of(context).position;
|
||||||
_position = Scrollable.of(context)?.position;
|
_position.isScrollingNotifier.addListener(_isScrollingListener);
|
||||||
if (_position != null)
|
|
||||||
_position.isScrollingNotifier.addListener(_isScrollingListener);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
if (_position != null)
|
_position.isScrollingNotifier.removeListener(_isScrollingListener);
|
||||||
_position.isScrollingNotifier.removeListener(_isScrollingListener);
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSliverFloatingPersistentHeader _headerRenderer() {
|
RenderSliverFloatingPersistentHeader _headerRenderer() {
|
||||||
return context.ancestorRenderObjectOfType(
|
return context.findAncestorRenderObjectOfType<RenderSliverFloatingPersistentHeader>(
|
||||||
const TypeMatcher<RenderSliverFloatingPersistentHeader>());
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _isScrollingListener() {
|
void _isScrollingListener() {
|
||||||
if (_position == null) return;
|
|
||||||
|
|
||||||
// When a scroll stops, then maybe snap the appbar into view.
|
|
||||||
// Similarly, when a scroll starts, then maybe stop the snap animation.
|
|
||||||
final RenderSliverFloatingPersistentHeader header = _headerRenderer();
|
final RenderSliverFloatingPersistentHeader header = _headerRenderer();
|
||||||
if (_position.isScrollingNotifier.value)
|
if (_position.isScrollingNotifier.value)
|
||||||
header?.maybeStopSnapAnimation(_position.userScrollDirection);
|
header.maybeStopSnapAnimation(_position.userScrollDirection);
|
||||||
else
|
else
|
||||||
header?.maybeStartSnapAnimation(_position.userScrollDirection);
|
header.maybeStartSnapAnimation(_position.userScrollDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -132,7 +132,6 @@ void _processFile(
|
|||||||
if (item.isValid) {
|
if (item.isValid) {
|
||||||
if (!cache.addName(item.name)) continue;
|
if (!cache.addName(item.name)) continue;
|
||||||
final _template = _processClass(item, input);
|
final _template = _processClass(item, input);
|
||||||
if (_template == null) continue;
|
|
||||||
final name = ReCase(item.name).snakeCase;
|
final name = ReCase(item.name).snakeCase;
|
||||||
final _path = 'classes/' + name + '.dart';
|
final _path = 'classes/' + name + '.dart';
|
||||||
final _file = _getFile(output.path, _path);
|
final _file = _getFile(output.path, _path);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import 'src/index.dart';
|
|||||||
export 'src/index.dart';
|
export 'src/index.dart';
|
||||||
|
|
||||||
DartResult parseSource(String source, [String path]) {
|
DartResult parseSource(String source, [String path]) {
|
||||||
assert(source != null && source.isNotEmpty);
|
assert(source.isNotEmpty);
|
||||||
final result = parseString(
|
final result = parseString(
|
||||||
content: source,
|
content: source,
|
||||||
path: path,
|
path: path,
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ extension ClauseDeclarationImplUtils on ClassDeclarationImpl {
|
|||||||
comments.add(item.toDartComment());
|
comments.add(item.toDartComment());
|
||||||
}
|
}
|
||||||
return base.copyWith(
|
return base.copyWith(
|
||||||
isAbstract: this?.abstractKeyword != null,
|
isAbstract: this.abstractKeyword != null,
|
||||||
extendsClause: this?.extendsClause?.toString(),
|
extendsClause: this.extendsClause?.toString(),
|
||||||
implementsClause: this?.implementsClause?.toString(),
|
implementsClause: this.implementsClause?.toString(),
|
||||||
withClause: this?.withClause?.toString(),
|
withClause: this.withClause?.toString(),
|
||||||
fields: fields,
|
fields: fields,
|
||||||
constructors: constructors,
|
constructors: constructors,
|
||||||
methods: methods,
|
methods: methods,
|
||||||
|
|||||||
@@ -51,12 +51,11 @@ extension DefaultFormalParameterImplUtils on DefaultFormalParameterImpl {
|
|||||||
base = base.copyWith(name: child.toString());
|
base = base.copyWith(name: child.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fields != null)
|
for (final field in fields) {
|
||||||
for (final field in fields) {
|
if (field.name == base.name) {
|
||||||
if (field.name == base.name) {
|
base = base.copyWith(type: field.type);
|
||||||
base = base.copyWith(type: field.type);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (node.runtimeType.toString() == 'SimpleToken' &&
|
if (node.runtimeType.toString() == 'SimpleToken' &&
|
||||||
node.toString() == '=') {
|
node.toString() == '=') {
|
||||||
|
|||||||
@@ -38,22 +38,22 @@ class GenParser {
|
|||||||
|
|
||||||
void merge(String source) {
|
void merge(String source) {
|
||||||
final DartResult result = parseSource(source);
|
final DartResult result = parseSource(source);
|
||||||
if (result?.file != null) {
|
if (result.file != null) {
|
||||||
if (result?.file?.classes != null) {
|
if (result.file?.classes != null) {
|
||||||
for (final item in result.file.classes) {
|
for (final item in result.file.classes) {
|
||||||
this._classes.putIfAbsent(item.name, () => item);
|
this._classes.putIfAbsent(item.name, () => item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result?.file?.enums != null) {
|
if (result.file?.enums != null) {
|
||||||
this._enums.addAll(result.file.enums);
|
this._enums.addAll(result.file.enums);
|
||||||
}
|
}
|
||||||
if (result?.file?.fields != null) {
|
if (result.file?.fields != null) {
|
||||||
this._fields.addAll(result.file.fields);
|
this._fields.addAll(result.file.fields);
|
||||||
}
|
}
|
||||||
if (result?.file?.methods != null) {
|
if (result.file?.methods != null) {
|
||||||
this._methods.addAll(result.file.methods);
|
this._methods.addAll(result.file.methods);
|
||||||
}
|
}
|
||||||
if (result?.file?.imports != null) {
|
if (result.file?.imports != null) {
|
||||||
this._imports.addAll(result.file.imports);
|
this._imports.addAll(result.file.imports);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ abstract class NgDartCommand extends Command {
|
|||||||
String readArg(String errorMessage) {
|
String readArg(String errorMessage) {
|
||||||
var args = argResults.rest;
|
var args = argResults.rest;
|
||||||
|
|
||||||
if (args == null || args.length == 0) {
|
if (args.length == 0) {
|
||||||
// Usage is provided by command runner.
|
// Usage is provided by command runner.
|
||||||
throw new UsageException(errorMessage, '');
|
throw new UsageException(errorMessage, '');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ class FileReader {
|
|||||||
|
|
||||||
FileReader._();
|
FileReader._();
|
||||||
|
|
||||||
String readAsString(String filePath, {Encoding encoding: utf8}) =>
|
String readAsString(String filePath, {Encoding encoding = utf8}) =>
|
||||||
new File(filePath).readAsStringSync(encoding: encoding);
|
new File(filePath).readAsStringSync(encoding: encoding);
|
||||||
|
|
||||||
List<String> readAsLines(String filePath, {Encoding encoding: utf8}) =>
|
List<String> readAsLines(String filePath, {Encoding encoding = utf8}) =>
|
||||||
new File(filePath).readAsLinesSync(encoding: encoding);
|
new File(filePath).readAsLinesSync(encoding: encoding);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ class PackageUriResolver {
|
|||||||
|
|
||||||
/// Resolves a package URI to a file path.
|
/// Resolves a package URI to a file path.
|
||||||
String resolve(String packageUri) {
|
String resolve(String packageUri) {
|
||||||
if (_packageMap == null) _buildPackageMap();
|
|
||||||
|
|
||||||
var packageName = getPackageName(packageUri);
|
var packageName = getPackageName(packageUri);
|
||||||
|
|
||||||
if (_packageMap[packageName] == null) {
|
if (_packageMap[packageName] == null) {
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class _Selector {
|
|||||||
return new _Selector('ByTagName', element.localName);
|
return new _Selector('ByTagName', element.localName);
|
||||||
}
|
}
|
||||||
|
|
||||||
_Selector(this.type, this.name, [this.value]);
|
_Selector(this.type, this.name);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => "@$type('${value ?? name}')";
|
String toString() => "@$type('${value ?? name}')";
|
||||||
@@ -99,9 +99,6 @@ class _Variable implements Comparable<_Variable> {
|
|||||||
|
|
||||||
factory _Variable.fromElement(Element element) {
|
factory _Variable.fromElement(Element element) {
|
||||||
var selector = new _Selector.fromElement(element);
|
var selector = new _Selector.fromElement(element);
|
||||||
if (selector == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var type = new DartClassInfo(
|
var type = new DartClassInfo(
|
||||||
'PageLoaderElement', 'package:pageloader/objects.dart');
|
'PageLoaderElement', 'package:pageloader/objects.dart');
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class ProjectModel {
|
|||||||
this.componentClassUri, this.dartClasses, this.components, this.modules);
|
this.componentClassUri, this.dartClasses, this.components, this.modules);
|
||||||
|
|
||||||
/// Whether providers are needed when generating test.
|
/// Whether providers are needed when generating test.
|
||||||
bool get needProviders => serviceClasses != null && serviceClasses.isNotEmpty;
|
bool get needProviders => serviceClasses.isNotEmpty;
|
||||||
|
|
||||||
/// Uris for service classes used.
|
/// Uris for service classes used.
|
||||||
List<String> get referencedUris => serviceClasses
|
List<String> get referencedUris => serviceClasses
|
||||||
@@ -84,10 +84,6 @@ class ProjectModel {
|
|||||||
file, out, asts.publicUris, _getBindingVariables(components))));
|
file, out, asts.publicUris, _getBindingVariables(components))));
|
||||||
|
|
||||||
var componentClassName = className;
|
var componentClassName = className;
|
||||||
if (componentClassName == null) {
|
|
||||||
componentClassName =
|
|
||||||
_getComponentClassName(componentClassUri, components);
|
|
||||||
}
|
|
||||||
|
|
||||||
var serviceClasses = _getServiceClasses(
|
var serviceClasses = _getServiceClasses(
|
||||||
componentClassName, dartClasses, components, modules);
|
componentClassName, dartClasses, components, modules);
|
||||||
@@ -125,8 +121,6 @@ Set<String> _getBindingVariables(Map<String, ComponentInfo> components) {
|
|||||||
var result = new Set<String>();
|
var result = new Set<String>();
|
||||||
|
|
||||||
for (var component in components.values) {
|
for (var component in components.values) {
|
||||||
if (component.module == null) continue;
|
|
||||||
|
|
||||||
for (var binding in component.module.directChildren) {
|
for (var binding in component.module.directChildren) {
|
||||||
if (binding is String) result.add(binding);
|
if (binding is String) result.add(binding);
|
||||||
}
|
}
|
||||||
@@ -159,17 +153,14 @@ List<String> _getServiceClasses(
|
|||||||
var dependencies = <String>[];
|
var dependencies = <String>[];
|
||||||
for (var parameter in dartClasses[componentClassName].constructorParameters) {
|
for (var parameter in dartClasses[componentClassName].constructorParameters) {
|
||||||
var service = parameter.dependency;
|
var service = parameter.dependency;
|
||||||
if (dartClasses[service].uri == null) continue;
|
|
||||||
|
|
||||||
dependencies.add(service);
|
dependencies.add(service);
|
||||||
}
|
}
|
||||||
|
|
||||||
var module = components[componentClassName].module;
|
var module = components[componentClassName].module;
|
||||||
if (module != null) {
|
for (var binding in module.getAllBindingInstances(modules)) {
|
||||||
for (var binding in module.getAllBindingInstances(modules)) {
|
if (dependencies.contains(binding.className)) {
|
||||||
if (dependencies.contains(binding.className)) {
|
dependencies.remove(binding.className);
|
||||||
dependencies.remove(binding.className);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ void processBindingElement(Expression node, ModuleInfo module) {
|
|||||||
throw new UnsupportedError('Unable to handle $node.');
|
throw new UnsupportedError('Unable to handle $node.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (binding != null) module.directChildren.add(binding);
|
module.directChildren.add(binding);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extracts binding information from instance creation expression [node].
|
/// Extracts binding information from instance creation expression [node].
|
||||||
@@ -107,10 +107,8 @@ BindingInstance _buildBindingInstance(
|
|||||||
binding = new BindingInstance(token.value, creationExpression);
|
binding = new BindingInstance(token.value, creationExpression);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (binding != null) {
|
_handleBindingArgs(args, binding);
|
||||||
_handleBindingArgs(args, binding);
|
return binding;
|
||||||
return binding;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new UnsupportedError('Unable to handle $token '
|
throw new UnsupportedError('Unable to handle $token '
|
||||||
'(${token.runtimeType}) in $creationExpression');
|
'(${token.runtimeType}) in $creationExpression');
|
||||||
|
|||||||
@@ -53,10 +53,8 @@ class ModuleInfo extends BindingInfo {
|
|||||||
/// Expands binding information in this module.
|
/// Expands binding information in this module.
|
||||||
List<BindingInstance> getAllBindingInstances(
|
List<BindingInstance> getAllBindingInstances(
|
||||||
Map<String, ModuleInfo> allModules) {
|
Map<String, ModuleInfo> allModules) {
|
||||||
if (_allBindingInstances != null) {
|
return _allBindingInstances;
|
||||||
return _allBindingInstances;
|
|
||||||
}
|
|
||||||
|
|
||||||
_allBindingInstances = [];
|
_allBindingInstances = [];
|
||||||
|
|
||||||
for (var binding in directChildren) {
|
for (var binding in directChildren) {
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class DartClassVisitor extends RecursiveAstVisitor {
|
|||||||
var classInfo = _getClass(className(classDeclaration));
|
var classInfo = _getClass(className(classDeclaration));
|
||||||
|
|
||||||
// Only first appeared class is used to get more accurate matching.
|
// Only first appeared class is used to get more accurate matching.
|
||||||
if (classInfo.uri != null) return;
|
return;
|
||||||
|
|
||||||
classInfo.uri = _publicUris[_uri];
|
classInfo.uri = _publicUris[_uri];
|
||||||
|
|
||||||
|
|||||||
@@ -97,13 +97,13 @@ var _dotPackages = ['a:a/lib/', 'b:b/lib/'];
|
|||||||
|
|
||||||
class FileReaderMock implements FileReader {
|
class FileReaderMock implements FileReader {
|
||||||
@override
|
@override
|
||||||
List<String> readAsLines(String filePath, {Encoding encoding: utf8}) {
|
List<String> readAsLines(String filePath, {Encoding encoding = utf8}) {
|
||||||
if (filePath == '.packages') return _dotPackages;
|
if (filePath == '.packages') return _dotPackages;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String readAsString(String filePath, {Encoding encoding: utf8}) {
|
String readAsString(String filePath, {Encoding encoding = utf8}) {
|
||||||
for (var file in _files) {
|
for (var file in _files) {
|
||||||
if (file['path'] == filePath) return file['content'];
|
if (file['path'] == filePath) return file['content'];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ var _pubSpec = ['name: hello_flutter'];
|
|||||||
|
|
||||||
class FileReaderMock implements FileReader {
|
class FileReaderMock implements FileReader {
|
||||||
@override
|
@override
|
||||||
List<String> readAsLines(String filePath, {Encoding encoding: utf8}) {
|
List<String> readAsLines(String filePath, {Encoding encoding = utf8}) {
|
||||||
if (filePath == '.packages') {
|
if (filePath == '.packages') {
|
||||||
return _dotPackages;
|
return _dotPackages;
|
||||||
} else if (filePath == 'pubspec.yaml') {
|
} else if (filePath == 'pubspec.yaml') {
|
||||||
@@ -111,7 +111,7 @@ class FileReaderMock implements FileReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String readAsString(String filePath, {Encoding encoding: utf8}) {
|
String readAsString(String filePath, {Encoding encoding = utf8}) {
|
||||||
for (var file in _files) {
|
for (var file in _files) {
|
||||||
if (file['path'] == filePath) return file['content'];
|
if (file['path'] == filePath) return file['content'];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,11 +60,11 @@ class FileReaderMock implements FileReader {
|
|||||||
];
|
];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<String> readAsLines(Object uri, {Encoding encoding: utf8}) {
|
List<String> readAsLines(Object uri, {Encoding encoding = utf8}) {
|
||||||
if (uri is String && uri == '.packages') return _dotPackages;
|
if (uri is String && uri == '.packages') return _dotPackages;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String readAsString(Object uri, {Encoding encoding: utf8}) => null;
|
String readAsString(Object uri, {Encoding encoding = utf8}) => null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ var _pubSpec = ['name: a'];
|
|||||||
|
|
||||||
class FileReaderMock implements FileReader {
|
class FileReaderMock implements FileReader {
|
||||||
@override
|
@override
|
||||||
List<String> readAsLines(String filePath, {Encoding encoding: utf8}) {
|
List<String> readAsLines(String filePath, {Encoding encoding = utf8}) {
|
||||||
if (filePath == '.packages') {
|
if (filePath == '.packages') {
|
||||||
return _dotPackages;
|
return _dotPackages;
|
||||||
} else if (filePath == 'pubspec.yaml') {
|
} else if (filePath == 'pubspec.yaml') {
|
||||||
@@ -118,7 +118,7 @@ class FileReaderMock implements FileReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String readAsString(String filePath, {Encoding encoding: utf8}) {
|
String readAsString(String filePath, {Encoding encoding = utf8}) {
|
||||||
for (var file in _files) {
|
for (var file in _files) {
|
||||||
if (file['path'] == filePath) return file['content'];
|
if (file['path'] == filePath) return file['content'];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,10 +51,8 @@ class _TaggedDataViewState<T> extends State<TaggedDataView<T>> {
|
|||||||
final allTags = [...folders, ...other].toSet().toList();
|
final allTags = [...folders, ...other].toSet().toList();
|
||||||
allTags.sort();
|
allTags.sort();
|
||||||
final emptyBuilder = () {
|
final emptyBuilder = () {
|
||||||
if (widget?.emptyBuilder != null) {
|
return widget.emptyBuilder(context);
|
||||||
return widget.emptyBuilder(context);
|
return Scaffold(
|
||||||
}
|
|
||||||
return Scaffold(
|
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
title: Text('Details'),
|
title: Text('Details'),
|
||||||
@@ -66,10 +64,8 @@ class _TaggedDataViewState<T> extends State<TaggedDataView<T>> {
|
|||||||
};
|
};
|
||||||
final detailBuilder = (int index) {
|
final detailBuilder = (int index) {
|
||||||
final T item = widget.dataSource.items[index];
|
final T item = widget.dataSource.items[index];
|
||||||
if (widget?.detailBuilder != null) {
|
return widget.detailBuilder(context, item, index);
|
||||||
return widget.detailBuilder(context, item, index);
|
return Scaffold(
|
||||||
}
|
|
||||||
return Scaffold(
|
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
title: Text('Details'),
|
title: Text('Details'),
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ abstract class TaggedDataTableSource<T> extends DataSource<T> {
|
|||||||
}
|
}
|
||||||
return Icons.info;
|
return Icons.info;
|
||||||
};
|
};
|
||||||
if (iconData() == null) return null;
|
|
||||||
return Icon(iconData());
|
return Icon(iconData());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,16 +63,12 @@ abstract class TaggedDataTableSource<T> extends DataSource<T> {
|
|||||||
final _results = <int, DataRow>{};
|
final _results = <int, DataRow>{};
|
||||||
for (var i = 0; i < rowCount; i++) {
|
for (var i = 0; i < rowCount; i++) {
|
||||||
final tags = getTagsForRow(i);
|
final tags = getTagsForRow(i);
|
||||||
if (_selected == null) {
|
for (final tag in tags) {
|
||||||
_results[i] = getRow(i);
|
if (tag.contains(_selected)) {
|
||||||
} else {
|
_results[i] = getRow(i);
|
||||||
for (final tag in tags) {
|
|
||||||
if (tag.contains(_selected)) {
|
|
||||||
_results[i] = getRow(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final search = this.search.toLowerCase();
|
final search = this.search.toLowerCase();
|
||||||
if (search.isEmpty) return _results;
|
if (search.isEmpty) return _results;
|
||||||
_results.clear();
|
_results.clear();
|
||||||
|
|||||||
@@ -74,37 +74,33 @@ class __WidgetAcceptState extends State<_WidgetAccept> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (widget.child != null) {
|
return widget.child;
|
||||||
return widget.child;
|
if (!widget.scope.isDragging) {
|
||||||
}
|
|
||||||
if (!widget.scope.isDragging) {
|
|
||||||
return SizedBox.fromSize(
|
return SizedBox.fromSize(
|
||||||
size: widget.sizeOnlyDragging ? null : widget.size,
|
size: widget.sizeOnlyDragging ? null : widget.size,
|
||||||
child: Container(),
|
child: Container(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: widget?.size?.height,
|
height: widget.size.height,
|
||||||
width: widget?.size?.width,
|
width: widget.size.width,
|
||||||
child: DragTarget<Map<String, dynamic>>(
|
child: DragTarget<Map<String, dynamic>>(
|
||||||
onAccept: (val) {
|
onAcceptWithDetails: (val) {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_accepting = false;
|
_accepting = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (val != null) {
|
final _data = val;
|
||||||
final _data = val;
|
_data['id'] = StringGen.id;
|
||||||
_data['id'] = StringGen.id;
|
if (_data['name'] == 'Text') {
|
||||||
if (_data['name'] == 'Text') {
|
_data['params']['style']['id'] = StringGen.id;
|
||||||
_data['params']['style']['id'] = StringGen.id;
|
|
||||||
}
|
|
||||||
if (_data['name'] == 'Icon') {
|
|
||||||
_data['params']['0']['id'] = StringGen.id;
|
|
||||||
}
|
|
||||||
widget.onAccept(context, _data);
|
|
||||||
}
|
}
|
||||||
},
|
if (_data['name'] == 'Icon') {
|
||||||
|
_data['params']['0']['id'] = StringGen.id;
|
||||||
|
}
|
||||||
|
widget.onAccept(context, _data);
|
||||||
|
},
|
||||||
onLeave: (val) {
|
onLeave: (val) {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
setState(() {
|
||||||
@@ -112,7 +108,7 @@ class __WidgetAcceptState extends State<_WidgetAccept> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onWillAccept: (val) {
|
onWillAcceptWithDetails: (val) {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_accepting = true;
|
_accepting = true;
|
||||||
@@ -123,11 +119,11 @@ class __WidgetAcceptState extends State<_WidgetAccept> {
|
|||||||
builder: (context, accepted, rejected) {
|
builder: (context, accepted, rejected) {
|
||||||
return Center(
|
return Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
width: widget?.size?.width,
|
width: widget.size.width,
|
||||||
height: widget?.size?.height,
|
height: widget.size.height,
|
||||||
child: Placeholder(
|
child: Placeholder(
|
||||||
color:
|
color:
|
||||||
!_accepting ? Colors.grey : Theme.of(context).accentColor,
|
!_accepting ? Colors.grey : Theme.of(context).colorScheme.secondary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -143,13 +139,9 @@ Map<String, dynamic> modifyAccept(Map<String, dynamic> val,
|
|||||||
_data['id'] = StringGen.id;
|
_data['id'] = StringGen.id;
|
||||||
switch (_data['name']) {
|
switch (_data['name']) {
|
||||||
case 'Container':
|
case 'Container':
|
||||||
if (height != null) {
|
_data['params']['height'] = height;
|
||||||
_data['params']['height'] = height;
|
_data['params']['width'] = width;
|
||||||
}
|
break;
|
||||||
if (width != null) {
|
|
||||||
_data['params']['width'] = width;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
return _data;
|
return _data;
|
||||||
|
|||||||
@@ -25,104 +25,95 @@ class DynamicWidget extends StatelessWidget implements WidgetLibrary {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WidgetConfig get base {
|
WidgetConfig get base {
|
||||||
if (data != null) {
|
if (library[data['name']] != null) {
|
||||||
if (library[data['name']] != null) {
|
final _base = library[data['name']];
|
||||||
final _base = library[data['name']];
|
if (_base != null) {
|
||||||
if (_base != null) {
|
return _base;
|
||||||
return _base;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (unknownWidgetBuilder != null) {
|
|
||||||
return unknownWidgetBuilder(data);
|
return unknownWidgetBuilder(data);
|
||||||
}
|
return null;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void onAction(BuildContext context, String val) {
|
static void onAction(BuildContext context, String val) {
|
||||||
final data = val;
|
final data = val;
|
||||||
if (data == null) return null;
|
if (data.isEmpty) return null;
|
||||||
if (data is String) {
|
final _data = data.replaceAll('#', '');
|
||||||
if (data.isEmpty) return null;
|
if (_data.startsWith('message')) {
|
||||||
final _data = data.replaceAll('#', '');
|
final _message = _data
|
||||||
if (_data.startsWith('message')) {
|
.replaceAll('message(', '')
|
||||||
final _message = _data
|
.replaceAll('(', '')
|
||||||
.replaceAll('message(', '')
|
.replaceAll(')', '');
|
||||||
.replaceAll('(', '')
|
Scaffold.of(context).showSnackBar(SnackBar(
|
||||||
.replaceAll(')', '');
|
content: Text(_message),
|
||||||
Scaffold.of(context).showSnackBar(SnackBar(
|
));
|
||||||
content: Text(_message),
|
return;
|
||||||
));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_data.startsWith('navigate')) {
|
|
||||||
final _route = _data
|
|
||||||
.replaceAll('navigate(', '')
|
|
||||||
.replaceAll('(', '')
|
|
||||||
.replaceAll(')', '');
|
|
||||||
Navigator.of(context).pushNamed(_route);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_data.startsWith('pop')) {
|
|
||||||
final _route = _data
|
|
||||||
.replaceAll('pop(', '')
|
|
||||||
.replaceAll('(', '')
|
|
||||||
.replaceAll(')', '');
|
|
||||||
if (_route.isNotEmpty) {
|
|
||||||
Navigator.popUntil(context, ModalRoute.withName(_route));
|
|
||||||
} else {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_data.startsWith('maybePop')) {
|
|
||||||
Navigator.of(context).maybePop();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_data.startsWith('launch')) {
|
|
||||||
final _url = _data
|
|
||||||
.replaceAll("launch(", '')
|
|
||||||
.replaceAll('(', '')
|
|
||||||
.replaceAll(')', '')
|
|
||||||
.replaceAll("\'", '');
|
|
||||||
launch('$_url');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_data.startsWith('alert')) {
|
|
||||||
final _message = _data
|
|
||||||
.replaceAll('alert(', '')
|
|
||||||
.replaceAll('(', '')
|
|
||||||
.replaceAll(')', '');
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) => AlertDialog(
|
|
||||||
title: Text('Info'),
|
|
||||||
content: Text(_message),
|
|
||||||
actions: [
|
|
||||||
FlatButton(
|
|
||||||
child: Text('Ok'),
|
|
||||||
onPressed: () => Navigator.maybePop(context),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
if (_data.startsWith('navigate')) {
|
||||||
|
final _route = _data
|
||||||
|
.replaceAll('navigate(', '')
|
||||||
|
.replaceAll('(', '')
|
||||||
|
.replaceAll(')', '');
|
||||||
|
Navigator.of(context).pushNamed(_route);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_data.startsWith('pop')) {
|
||||||
|
final _route = _data
|
||||||
|
.replaceAll('pop(', '')
|
||||||
|
.replaceAll('(', '')
|
||||||
|
.replaceAll(')', '');
|
||||||
|
if (_route.isNotEmpty) {
|
||||||
|
Navigator.popUntil(context, ModalRoute.withName(_route));
|
||||||
|
} else {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_data.startsWith('maybePop')) {
|
||||||
|
Navigator.of(context).maybePop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_data.startsWith('launch')) {
|
||||||
|
final _url = _data
|
||||||
|
.replaceAll("launch(", '')
|
||||||
|
.replaceAll('(', '')
|
||||||
|
.replaceAll(')', '')
|
||||||
|
.replaceAll("\'", '');
|
||||||
|
launch('$_url');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_data.startsWith('alert')) {
|
||||||
|
final _message = _data
|
||||||
|
.replaceAll('alert(', '')
|
||||||
|
.replaceAll('(', '')
|
||||||
|
.replaceAll(')', '');
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
title: Text('Info'),
|
||||||
|
content: Text(_message),
|
||||||
|
actions: [
|
||||||
|
FlatButton(
|
||||||
|
child: Text('Ok'),
|
||||||
|
onPressed: () => Navigator.maybePop(context),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget render(BuildContext context, [bool nullOk = false]) {
|
Widget render(BuildContext context, [bool nullOk = false]) {
|
||||||
if (base != null) {
|
if (base is WidgetBase) {
|
||||||
if (base is WidgetBase) {
|
return Builder(
|
||||||
return Builder(
|
builder: (context) {
|
||||||
builder: (context) {
|
return (base as WidgetBase).build(context);
|
||||||
return (base as WidgetBase)?.build(context);
|
},
|
||||||
},
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (nullOk) {
|
if (nullOk) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return Container();
|
return Container();
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import '../../flutter_dynamic_widget.dart';
|
import '../../flutter_dynamic_widget.dart';
|
||||||
import '../base.dart';
|
|
||||||
import './index.dart';
|
|
||||||
|
|
||||||
class MaterialBase extends WidgetLibrary {
|
class MaterialBase extends WidgetLibrary {
|
||||||
MaterialBase(this.data, this.widgetContext);
|
MaterialBase(this.data, this.widgetContext);
|
||||||
@@ -10,7 +8,7 @@ class MaterialBase extends WidgetLibrary {
|
|||||||
GenerateWidget get widgetRender => (context, data) {
|
GenerateWidget get widgetRender => (context, data) {
|
||||||
if (data is Map) {
|
if (data is Map) {
|
||||||
final _base = MaterialBase(data, context);
|
final _base = MaterialBase(data, context);
|
||||||
final _config = _base?.base;
|
final _config = _base.base;
|
||||||
if (_config is WidgetBase) {
|
if (_config is WidgetBase) {
|
||||||
return _config;
|
return _config;
|
||||||
}
|
}
|
||||||
@@ -40,14 +38,13 @@ class MaterialBase extends WidgetLibrary {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
WidgetConfig get base {
|
WidgetConfig get base {
|
||||||
if (data == null) return null;
|
|
||||||
final name = data['name'].toString();
|
final name = data['name'].toString();
|
||||||
final _materialBase = library[name];
|
final _materialBase = library[name];
|
||||||
if (_materialBase != null) return _materialBase;
|
if (_materialBase != null) return _materialBase;
|
||||||
return DynamicWidget(
|
return DynamicWidget(
|
||||||
data: data,
|
data: data,
|
||||||
widgetContext: widgetContext,
|
widgetContext: widgetContext,
|
||||||
)?.base;
|
).base;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ActionCallback onAction = (context, val) {
|
static ActionCallback onAction = (context, val) {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'package:url_launcher/url_launcher.dart';
|
|||||||
import 'string_gen.dart';
|
import 'string_gen.dart';
|
||||||
|
|
||||||
T getEnum<T>(String val, {T fallback, List<T> values}) {
|
T getEnum<T>(String val, {T fallback, List<T> values}) {
|
||||||
if (val == null) return fallback;
|
|
||||||
final _value = val.replaceAll('#', '');
|
final _value = val.replaceAll('#', '');
|
||||||
return values.firstWhere(
|
return values.firstWhere(
|
||||||
(element) => element.toString() == _value,
|
(element) => element.toString() == _value,
|
||||||
@@ -21,7 +20,6 @@ Key getKey(dynamic value, [Key fallback]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Paint getPaint(Map<String, dynamic> data, [Paint fallback]) {
|
Paint getPaint(Map<String, dynamic> data, [Paint fallback]) {
|
||||||
if (data == null) return fallback;
|
|
||||||
if (data['params'] == null) return fallback;
|
if (data['params'] == null) return fallback;
|
||||||
final params = data['params'];
|
final params = data['params'];
|
||||||
// TODO: get values here
|
// TODO: get values here
|
||||||
@@ -29,7 +27,6 @@ Paint getPaint(Map<String, dynamic> data, [Paint fallback]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Decoration getDecoration(Map<String, dynamic> data, [Decoration fallback]) {
|
Decoration getDecoration(Map<String, dynamic> data, [Decoration fallback]) {
|
||||||
if (data == null) return fallback;
|
|
||||||
if (data['params'] == null) return fallback;
|
if (data['params'] == null) return fallback;
|
||||||
final params = data['params'];
|
final params = data['params'];
|
||||||
// TODO: get values here
|
// TODO: get values here
|
||||||
@@ -37,7 +34,6 @@ Decoration getDecoration(Map<String, dynamic> data, [Decoration fallback]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Duration getDuration(Map<String, dynamic> data, [Duration fallback]) {
|
Duration getDuration(Map<String, dynamic> data, [Duration fallback]) {
|
||||||
if (data == null) return fallback;
|
|
||||||
if (data['params'] == null) return fallback;
|
if (data['params'] == null) return fallback;
|
||||||
final params = data['params'];
|
final params = data['params'];
|
||||||
if (!params.toString().contains('zero')) {
|
if (!params.toString().contains('zero')) {
|
||||||
@@ -62,7 +58,6 @@ Duration getDuration(Map<String, dynamic> data, [Duration fallback]) {
|
|||||||
|
|
||||||
BorderRadiusGeometry getBorderRadiusGeometry(Map<String, dynamic> data,
|
BorderRadiusGeometry getBorderRadiusGeometry(Map<String, dynamic> data,
|
||||||
[BorderRadiusGeometry fallback]) {
|
[BorderRadiusGeometry fallback]) {
|
||||||
if (data == null) return fallback;
|
|
||||||
if (data['params'] == null) return fallback;
|
if (data['params'] == null) return fallback;
|
||||||
final params = data['params'];
|
final params = data['params'];
|
||||||
// TODO: get values here
|
// TODO: get values here
|
||||||
@@ -70,7 +65,6 @@ BorderRadiusGeometry getBorderRadiusGeometry(Map<String, dynamic> data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Matrix4 getMatrix4(Map<String, dynamic> data, [Matrix4 fallback]) {
|
Matrix4 getMatrix4(Map<String, dynamic> data, [Matrix4 fallback]) {
|
||||||
if (data == null) return fallback;
|
|
||||||
if (data['params'] == null) return fallback;
|
if (data['params'] == null) return fallback;
|
||||||
final params = data['params'];
|
final params = data['params'];
|
||||||
// TODO: get values here
|
// TODO: get values here
|
||||||
@@ -79,7 +73,6 @@ Matrix4 getMatrix4(Map<String, dynamic> data, [Matrix4 fallback]) {
|
|||||||
|
|
||||||
BorderStyle getBorderStyle(Map<String, dynamic> data,
|
BorderStyle getBorderStyle(Map<String, dynamic> data,
|
||||||
[BorderStyle fallback = BorderStyle.none]) {
|
[BorderStyle fallback = BorderStyle.none]) {
|
||||||
if (data == null) return fallback;
|
|
||||||
if (data['params'] == null) return fallback;
|
if (data['params'] == null) return fallback;
|
||||||
final params = data['params'];
|
final params = data['params'];
|
||||||
// TODO: get values here
|
// TODO: get values here
|
||||||
@@ -87,7 +80,6 @@ BorderStyle getBorderStyle(Map<String, dynamic> data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
FocusNode getFocusNode(Map<String, dynamic> data, [FocusNode fallback]) {
|
FocusNode getFocusNode(Map<String, dynamic> data, [FocusNode fallback]) {
|
||||||
if (data == null) return fallback;
|
|
||||||
if (data['params'] == null) return fallback;
|
if (data['params'] == null) return fallback;
|
||||||
final params = data['params'];
|
final params = data['params'];
|
||||||
final debugLabel = getString(params['debugLabel']);
|
final debugLabel = getString(params['debugLabel']);
|
||||||
@@ -104,7 +96,6 @@ FocusNode getFocusNode(Map<String, dynamic> data, [FocusNode fallback]) {
|
|||||||
|
|
||||||
BorderSide getBorderSide(Map<String, dynamic> data,
|
BorderSide getBorderSide(Map<String, dynamic> data,
|
||||||
[BorderSide fallback = BorderSide.none]) {
|
[BorderSide fallback = BorderSide.none]) {
|
||||||
if (data == null) return fallback;
|
|
||||||
if (data['params'] == null) return fallback;
|
if (data['params'] == null) return fallback;
|
||||||
final params = data['params'];
|
final params = data['params'];
|
||||||
return null;
|
return null;
|
||||||
@@ -133,7 +124,6 @@ List<Alignment> getAlignmentValues() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ShapeBorder getShapeBorder(Map<String, dynamic> data, [ShapeBorder fallback]) {
|
ShapeBorder getShapeBorder(Map<String, dynamic> data, [ShapeBorder fallback]) {
|
||||||
if (data == null) return fallback;
|
|
||||||
if (data['params'] == null) return fallback;
|
if (data['params'] == null) return fallback;
|
||||||
final params = data['params'];
|
final params = data['params'];
|
||||||
final top = getBorderSide(params['top']);
|
final top = getBorderSide(params['top']);
|
||||||
@@ -167,7 +157,6 @@ ShapeBorder getShapeBorder(Map<String, dynamic> data, [ShapeBorder fallback]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Offset getOffset(Map<String, dynamic> data, [Offset fallback]) {
|
Offset getOffset(Map<String, dynamic> data, [Offset fallback]) {
|
||||||
if (data == null) return fallback;
|
|
||||||
if (data['params'] == null) return fallback;
|
if (data['params'] == null) return fallback;
|
||||||
final params = data['params'];
|
final params = data['params'];
|
||||||
final dx = getDouble(params['dx']);
|
final dx = getDouble(params['dx']);
|
||||||
@@ -176,7 +165,6 @@ Offset getOffset(Map<String, dynamic> data, [Offset fallback]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BoxShadow getBoxShadow(Map<String, dynamic> data, [BoxShadow fallback]) {
|
BoxShadow getBoxShadow(Map<String, dynamic> data, [BoxShadow fallback]) {
|
||||||
if (data == null) return fallback;
|
|
||||||
if (data['params'] == null) return fallback;
|
if (data['params'] == null) return fallback;
|
||||||
final params = data['params'];
|
final params = data['params'];
|
||||||
final color = getColor(params['color']);
|
final color = getColor(params['color']);
|
||||||
@@ -226,16 +214,14 @@ Map<String, dynamic> setIconData(IconData value) {
|
|||||||
'id': StringGen.id,
|
'id': StringGen.id,
|
||||||
'params': {
|
'params': {
|
||||||
'0': value.codePoint,
|
'0': value.codePoint,
|
||||||
if (value?.fontFamily != null) 'fontFamily': value?.fontFamily,
|
if (value.fontFamily != null) 'fontFamily': value.fontFamily,
|
||||||
if (value?.fontPackage != null) 'fontPackage': value?.fontPackage,
|
if (value.fontPackage != null) 'fontPackage': value.fontPackage,
|
||||||
if (value?.matchTextDirection != null)
|
'matchTextDirection': value.matchTextDirection,
|
||||||
'matchTextDirection': value?.matchTextDirection,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
IconData getIconData(Map<String, dynamic> data, [IconData fallback]) {
|
IconData getIconData(Map<String, dynamic> data, [IconData fallback]) {
|
||||||
if (data == null) return fallback;
|
|
||||||
final name = data['name'];
|
final name = data['name'];
|
||||||
if (name == 'IconData') {
|
if (name == 'IconData') {
|
||||||
final params = data['params'];
|
final params = data['params'];
|
||||||
@@ -258,10 +244,10 @@ IconData getIconData(Map<String, dynamic> data, [IconData fallback]) {
|
|||||||
getBool(params['matchTextDirection'], matchTextDirection);
|
getBool(params['matchTextDirection'], matchTextDirection);
|
||||||
}
|
}
|
||||||
return IconData(
|
return IconData(
|
||||||
codePoint ?? fallback?.codePoint,
|
codePoint ?? fallback.codePoint,
|
||||||
fontFamily: fontFamily ?? fallback?.fontFamily,
|
fontFamily: fontFamily ?? fallback.fontFamily,
|
||||||
fontPackage: fontPackage ?? fallback?.fontPackage,
|
fontPackage: fontPackage ?? fallback.fontPackage,
|
||||||
matchTextDirection: matchTextDirection ?? fallback?.matchTextDirection,
|
matchTextDirection: matchTextDirection ?? fallback.matchTextDirection,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return fallback;
|
return fallback;
|
||||||
@@ -455,10 +441,10 @@ Map<String, dynamic> setEdgeInsets(EdgeInsets val) {
|
|||||||
'id': StringGen.id,
|
'id': StringGen.id,
|
||||||
'name': 'EdgeInsets.only',
|
'name': 'EdgeInsets.only',
|
||||||
'params': {
|
'params': {
|
||||||
'top': val?.top ?? 0,
|
'top': val.top ?? 0,
|
||||||
'bottom': val?.bottom ?? 0,
|
'bottom': val.bottom ?? 0,
|
||||||
'left': val?.left ?? 0,
|
'left': val.left ?? 0,
|
||||||
'right': val?.right ?? 0,
|
'right': val.right ?? 0,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -471,10 +457,10 @@ extension EdgeInsetUtils on EdgeInsets {
|
|||||||
double bottom,
|
double bottom,
|
||||||
]) {
|
]) {
|
||||||
return EdgeInsets.only(
|
return EdgeInsets.only(
|
||||||
top: top ?? this?.top ?? 0,
|
top: top ?? this.top ?? 0,
|
||||||
left: left ?? this?.left ?? 0,
|
left: left ?? this.left ?? 0,
|
||||||
right: right ?? this?.right ?? 0,
|
right: right ?? this.right ?? 0,
|
||||||
bottom: bottom ?? this?.bottom ?? 0,
|
bottom: bottom ?? this.bottom ?? 0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:meta/meta.dart';
|
|
||||||
|
|
||||||
import 'base_class.dart';
|
import 'base_class.dart';
|
||||||
import 'widget_index.dart';
|
import 'widget_index.dart';
|
||||||
|
|||||||
@@ -941,13 +941,11 @@ class WidgetIndex {
|
|||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {
|
return {
|
||||||
'version': version,
|
'version': version,
|
||||||
'widgets': widgets?.map((x) => x?.toMap())?.toList(),
|
'widgets': widgets.map((x) => x.toMap()).toList(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static WidgetIndex fromMap(Map<String, dynamic> map) {
|
static WidgetIndex fromMap(Map<String, dynamic> map) {
|
||||||
if (map == null) return null;
|
|
||||||
|
|
||||||
return WidgetIndex(
|
return WidgetIndex(
|
||||||
version: map['version'],
|
version: map['version'],
|
||||||
widgets: List<FlutterWidget>.from(
|
widgets: List<FlutterWidget>.from(
|
||||||
@@ -980,8 +978,6 @@ class FlutterWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static FlutterWidget fromMap(Map<String, dynamic> map) {
|
static FlutterWidget fromMap(Map<String, dynamic> map) {
|
||||||
if (map == null) return null;
|
|
||||||
|
|
||||||
return FlutterWidget(
|
return FlutterWidget(
|
||||||
name: map['name'],
|
name: map['name'],
|
||||||
description: map['description'],
|
description: map['description'],
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
|
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
|
||||||
|
|
||||||
import 'method_channel.dart';
|
import 'method_channel.dart';
|
||||||
|
|||||||
@@ -10,17 +10,9 @@ void newWindow(
|
|||||||
}) {
|
}) {
|
||||||
final screen = html.window.screen;
|
final screen = html.window.screen;
|
||||||
double top = 0;
|
double top = 0;
|
||||||
if (dy != null) {
|
top = dy;
|
||||||
top = dy;
|
|
||||||
} else if (screen.height != null) {
|
|
||||||
top = (screen.height - height) / 2;
|
|
||||||
}
|
|
||||||
double left = 0;
|
double left = 0;
|
||||||
if (dx != null) {
|
left = dx;
|
||||||
left = dx;
|
|
||||||
} else if (screen.width != null) {
|
|
||||||
left = (screen.width - width) / 2;
|
|
||||||
}
|
|
||||||
final sb = StringBuffer();
|
final sb = StringBuffer();
|
||||||
sb.write("height=");
|
sb.write("height=");
|
||||||
sb.write(height);
|
sb.write(height);
|
||||||
|
|||||||
@@ -64,8 +64,6 @@ class NewWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static NewWindow fromMap(Map<String, dynamic> map) {
|
static NewWindow fromMap(Map<String, dynamic> map) {
|
||||||
if (map == null) return null;
|
|
||||||
|
|
||||||
return NewWindow(
|
return NewWindow(
|
||||||
url: map['url'],
|
url: map['url'],
|
||||||
width: map['width'],
|
width: map['width'],
|
||||||
@@ -114,8 +112,8 @@ void createWindow(NewWindow window) {
|
|||||||
window.url,
|
window.url,
|
||||||
window.width,
|
window.width,
|
||||||
window.height,
|
window.height,
|
||||||
dx: window?.offsetX,
|
dx: window.offsetX,
|
||||||
dy: window?.offsetY,
|
dy: window.offsetY,
|
||||||
name: window?.name,
|
name: window.name,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,10 +84,10 @@ class _MyAppState extends State<MyApp> {
|
|||||||
final height = size.height;
|
final height = size.height;
|
||||||
final width = size.width;
|
final width = size.width;
|
||||||
final sb = StringBuffer();
|
final sb = StringBuffer();
|
||||||
final top = offset?.dy ??
|
final top = offset.dy ??
|
||||||
(screen.height != null ? (screen.height - height) / 2 : 0);
|
(screen.height != null ? (screen.height - height) / 2 : 0);
|
||||||
final left =
|
final left =
|
||||||
offset?.dx ?? (screen.width != null ? (screen.width - width) / 2 : 0);
|
offset.dx ?? (screen.width != null ? (screen.width - width) / 2 : 0);
|
||||||
sb.write("height=");
|
sb.write("height=");
|
||||||
sb.write(height);
|
sb.write(height);
|
||||||
sb.write(",width=");
|
sb.write(",width=");
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'$_counter',
|
'$_counter',
|
||||||
style: Theme.of(context).textTheme.headline4,
|
style: Theme.of(context).textTheme.headlineMedium,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ class WasmLoader extends WasmImpl {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<bool> init() async {
|
Future<bool> init() async {
|
||||||
assert(_path != null);
|
|
||||||
final _data = await rootBundle.load(_path);
|
final _data = await rootBundle.load(_path);
|
||||||
_wasm = await Instance.fromBufferAsync(_data.buffer);
|
_wasm = await Instance.fromBufferAsync(_data.buffer);
|
||||||
return isReady;
|
return isReady;
|
||||||
|
|||||||
@@ -26,9 +26,7 @@ void _setTargetPlatformForDesktop() {
|
|||||||
} else if (Platform.isLinux || Platform.isWindows) {
|
} else if (Platform.isLinux || Platform.isWindows) {
|
||||||
targetPlatform = TargetPlatform.android;
|
targetPlatform = TargetPlatform.android;
|
||||||
}
|
}
|
||||||
if (targetPlatform != null) {
|
debugDefaultTargetPlatformOverride = targetPlatform;
|
||||||
debugDefaultTargetPlatformOverride = targetPlatform;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatefulWidget {
|
class MyApp extends StatefulWidget {
|
||||||
|
|||||||
@@ -12,9 +12,7 @@ class MyApp extends StatelessWidget {
|
|||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
title: 'Flutter Demo',
|
title: 'Flutter Demo',
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
primarySwatch: Colors.blue,
|
visualDensity: VisualDensity.adaptivePlatformDensity, colorScheme: ColorScheme.fromSwatch(primarySwatch: Colors.blue).copyWith(secondary: Colors.red),
|
||||||
accentColor: Colors.red,
|
|
||||||
visualDensity: VisualDensity.adaptivePlatformDensity,
|
|
||||||
),
|
),
|
||||||
home: MyHomePage(title: 'Flutter Golden Layout'),
|
home: MyHomePage(title: 'Flutter Golden Layout'),
|
||||||
);
|
);
|
||||||
@@ -88,7 +86,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
),
|
),
|
||||||
body: GoldenLayoutTheme(
|
body: GoldenLayoutTheme(
|
||||||
data: GoldenLayoutThemeData(
|
data: GoldenLayoutThemeData(
|
||||||
tabSelectedBackgroundColor: Theme.of(context).accentColor,
|
tabSelectedBackgroundColor: Theme.of(context).colorScheme.secondary,
|
||||||
),
|
),
|
||||||
child: GoldenLayout(
|
child: GoldenLayout(
|
||||||
controller: _controller,
|
controller: _controller,
|
||||||
@@ -103,7 +101,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
title: (context, selected, index) => Text(
|
title: (context, selected, index) => Text(
|
||||||
'Window $count',
|
'Window $count',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: selected ? Theme.of(context).accentColor : Colors.white,
|
color: selected ? Theme.of(context).colorScheme.secondary : Colors.white,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Container(color: Colors.red[100 * count]));
|
child: Container(color: Colors.red[100 * count]));
|
||||||
|
|||||||
@@ -34,55 +34,51 @@ class _GoldenLayoutState extends State<GoldenLayout> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
_controller = widget?.controller ?? WindowController();
|
_controller = widget.controller ?? WindowController();
|
||||||
if (widget?.collection != null) {
|
_controller.base = widget.collection;
|
||||||
_controller.base = widget.collection;
|
super.initState();
|
||||||
}
|
|
||||||
super.initState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return LayoutBuilder(builder: (context, dimens) {
|
return LayoutBuilder(builder: (context, dimens) {
|
||||||
if (_controller.fullScreen != null) {
|
return RenderWindowGroup(
|
||||||
return RenderWindowGroup(
|
onAddTab: widget.onAddTab,
|
||||||
onAddTab: widget.onAddTab,
|
onCancel: (val) {
|
||||||
onCancel: (val) {
|
_controller.addToBase(val);
|
||||||
_controller.addToBase(val);
|
},
|
||||||
},
|
isDragging: _isDragging,
|
||||||
isDragging: _isDragging,
|
onDraggingChanged: (val) {
|
||||||
onDraggingChanged: (val) {
|
if (mounted) {
|
||||||
if (mounted) {
|
setState(() {
|
||||||
setState(() {
|
_isDragging = val;
|
||||||
_isDragging = val;
|
});
|
||||||
});
|
}
|
||||||
}
|
},
|
||||||
},
|
popUpSize: widget.popupSize,
|
||||||
popUpSize: widget.popupSize,
|
minimize: true,
|
||||||
minimize: true,
|
group: _controller.fullScreen,
|
||||||
group: _controller.fullScreen,
|
onFullScreen: () {
|
||||||
onFullScreen: () {
|
if (mounted) {
|
||||||
if (mounted) {
|
setState(() {
|
||||||
setState(() {
|
_controller.exitFullScreen();
|
||||||
_controller.exitFullScreen();
|
});
|
||||||
});
|
}
|
||||||
}
|
},
|
||||||
},
|
onClose: !_controller.fullScreen.canClose
|
||||||
onClose: !_controller.fullScreen.canClose
|
? null
|
||||||
? null
|
: () {
|
||||||
: () {
|
if (mounted) {
|
||||||
if (mounted) {
|
setState(() {
|
||||||
setState(() {
|
_controller.exitFullScreen(true);
|
||||||
_controller.exitFullScreen(true);
|
});
|
||||||
});
|
}
|
||||||
}
|
},
|
||||||
},
|
update: () {
|
||||||
update: () {
|
if (mounted) setState(() {});
|
||||||
if (mounted) setState(() {});
|
},
|
||||||
},
|
);
|
||||||
);
|
return _renderItem(
|
||||||
}
|
|
||||||
return _renderItem(
|
|
||||||
_controller.base,
|
_controller.base,
|
||||||
index: 0,
|
index: 0,
|
||||||
size: Size(dimens.maxWidth, dimens.maxHeight),
|
size: Size(dimens.maxWidth, dimens.maxHeight),
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class _WindowAcceptRegionState extends State<WindowAcceptRegion> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SizedBox.fromSize(
|
return SizedBox.fromSize(
|
||||||
size: widget?.size,
|
size: widget.size,
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (context, dimens) => Stack(
|
builder: (context, dimens) => Stack(
|
||||||
fit: StackFit.expand,
|
fit: StackFit.expand,
|
||||||
@@ -42,22 +42,22 @@ class _WindowAcceptRegionState extends State<WindowAcceptRegion> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Positioned.fill(
|
Positioned.fill(
|
||||||
left: widget?.left ?? 0,
|
left: widget.left ?? 0,
|
||||||
right: widget?.right ?? 0,
|
right: widget.right ?? 0,
|
||||||
top: widget?.top ?? 0,
|
top: widget.top ?? 0,
|
||||||
bottom: widget?.bottom ?? 0,
|
bottom: widget.bottom ?? 0,
|
||||||
child: Container(
|
child: Container(
|
||||||
child: DragTarget<WindowTab>(
|
child: DragTarget<WindowTab>(
|
||||||
builder: (context, accepted, rejected) => Container(),
|
builder: (context, accepted, rejected) => Container(),
|
||||||
onAccept: (val) {
|
onAcceptWithDetails: (val) {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
setState(() {
|
||||||
accepting = false;
|
accepting = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (widget.onAccept != null) widget.onAccept(val);
|
widget.onAccept(val);
|
||||||
},
|
},
|
||||||
onWillAccept: (val) {
|
onWillAcceptWithDetails: (val) {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
setState(() {
|
||||||
accepting = true;
|
accepting = true;
|
||||||
|
|||||||
@@ -24,12 +24,8 @@ class WindowController extends ChangeNotifier {
|
|||||||
WindowCollection base = WindowColumn([]);
|
WindowCollection base = WindowColumn([]);
|
||||||
|
|
||||||
void addToBase(WindowTab tab) {
|
void addToBase(WindowTab tab) {
|
||||||
if (base == null) {
|
_addTab(base, tab);
|
||||||
base = WindowColumn([WindowGroup(tab)]);
|
notifyListeners();
|
||||||
} else {
|
|
||||||
_addTab(base, tab);
|
|
||||||
}
|
|
||||||
notifyListeners();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _addTab(WindowCollection item, WindowTab tab) {
|
bool _addTab(WindowCollection item, WindowTab tab) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class WindowColumn extends WindowCollection {
|
|||||||
|
|
||||||
class WindowGroup extends WindowCollection {
|
class WindowGroup extends WindowCollection {
|
||||||
WindowGroup([WindowTab tab, bool closeable = true]) {
|
WindowGroup([WindowTab tab, bool closeable = true]) {
|
||||||
if (tab != null) _tabs.add(tab);
|
_tabs.add(tab);
|
||||||
canClose = closeable;
|
canClose = closeable;
|
||||||
}
|
}
|
||||||
bool canClose = true;
|
bool canClose = true;
|
||||||
@@ -56,14 +56,9 @@ class WindowGroup extends WindowCollection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void addTab(WindowTab tab, [int index]) {
|
void addTab(WindowTab tab, [int index]) {
|
||||||
if (index != null) {
|
_tabs.insert(index, tab);
|
||||||
_tabs.insert(index, tab);
|
_activeTab = index;
|
||||||
_activeTab = index;
|
notifyListeners();
|
||||||
} else {
|
|
||||||
_tabs.add(tab);
|
|
||||||
_activeTab = _tabs.length - 1;
|
|
||||||
}
|
|
||||||
notifyListeners();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeTab(WindowTab tab) {
|
void removeTab(WindowTab tab) {
|
||||||
|
|||||||
@@ -54,11 +54,11 @@ class _RenderWindowGroupState extends State<RenderWindowGroup> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final _theme =
|
final _theme =
|
||||||
GoldenLayoutTheme.of(context)?.theme ?? GoldenLayoutThemeData();
|
GoldenLayoutTheme.of(context).theme ?? GoldenLayoutThemeData();
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
color: _theme?.backgroundColor,
|
color: _theme.backgroundColor,
|
||||||
height: 32,
|
height: 32,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
@@ -72,13 +72,12 @@ class _RenderWindowGroupState extends State<RenderWindowGroup> {
|
|||||||
for (var i = 0; i < widget.group.tabs.length; i++)
|
for (var i = 0; i < widget.group.tabs.length; i++)
|
||||||
Draggable<WindowTab>(
|
Draggable<WindowTab>(
|
||||||
data: widget.group.tabs[i],
|
data: widget.group.tabs[i],
|
||||||
dragAnchor: DragAnchor.child,
|
|
||||||
onDragStarted: () {
|
onDragStarted: () {
|
||||||
_draggingTab = widget.group.tabs[i];
|
_draggingTab = widget.group.tabs[i];
|
||||||
widget.group.removeTab(_draggingTab);
|
widget.group.removeTab(_draggingTab);
|
||||||
widget.update();
|
widget.update();
|
||||||
if (widget.group.tabs.isEmpty) {
|
if (widget.group.tabs.isEmpty) {
|
||||||
widget.onClose?.call();
|
widget.onClose.call();
|
||||||
}
|
}
|
||||||
widget.onDraggingChanged(true);
|
widget.onDraggingChanged(true);
|
||||||
},
|
},
|
||||||
@@ -128,7 +127,7 @@ class _RenderWindowGroupState extends State<RenderWindowGroup> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onWillAccept: (val) {
|
onWillAcceptWithDetails: (val) {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
setState(() {
|
||||||
accepting = i;
|
accepting = i;
|
||||||
@@ -136,7 +135,7 @@ class _RenderWindowGroupState extends State<RenderWindowGroup> {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
onAccept: (val) {
|
onAcceptWithDetails: (val) {
|
||||||
widget.onModify(
|
widget.onModify(
|
||||||
context, val, WindowPos.tab, accepting);
|
context, val, WindowPos.tab, accepting);
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
@@ -155,9 +154,9 @@ class _RenderWindowGroupState extends State<RenderWindowGroup> {
|
|||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: selected
|
color: selected
|
||||||
? _theme?.tabSelectedBackgroundColor ??
|
? _theme.tabSelectedBackgroundColor ??
|
||||||
Colors.grey.shade600
|
Colors.grey.shade600
|
||||||
: _theme?.backgroundColor,
|
: _theme.backgroundColor,
|
||||||
borderRadius: selected
|
borderRadius: selected
|
||||||
? BorderRadius.only(
|
? BorderRadius.only(
|
||||||
topLeft: Radius.circular(5),
|
topLeft: Radius.circular(5),
|
||||||
@@ -197,17 +196,17 @@ class _RenderWindowGroupState extends State<RenderWindowGroup> {
|
|||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.close,
|
Icons.close,
|
||||||
size: 18,
|
size: 18,
|
||||||
color: _theme?.tabIconColor ??
|
color: _theme.tabIconColor ??
|
||||||
Colors.white,
|
Colors.white,
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
widget.group.tabs[i].onClose
|
widget.group.tabs[i].onClose
|
||||||
?.call();
|
.call();
|
||||||
widget.group.removeTab(
|
widget.group.removeTab(
|
||||||
widget.group.tabs[i]);
|
widget.group.tabs[i]);
|
||||||
widget.update();
|
widget.update();
|
||||||
if (widget.group.tabs.isEmpty) {
|
if (widget.group.tabs.isEmpty) {
|
||||||
widget.onClose?.call();
|
widget.onClose.call();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -225,17 +224,16 @@ class _RenderWindowGroupState extends State<RenderWindowGroup> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
), dragAnchorStrategy: childDragAnchorStrategy,
|
||||||
),
|
),
|
||||||
if (widget.onAddTab != null)
|
IconButton(
|
||||||
IconButton(
|
iconSize: 20,
|
||||||
iconSize: 20,
|
icon: Icon(
|
||||||
icon: Icon(
|
Icons.add,
|
||||||
Icons.add,
|
color: Colors.white,
|
||||||
color: Colors.white,
|
),
|
||||||
),
|
onPressed: () =>
|
||||||
onPressed: () =>
|
widget.group.addTab(widget.onAddTab())),
|
||||||
widget.group.addTab(widget.onAddTab())),
|
|
||||||
if (widget.isDragging)
|
if (widget.isDragging)
|
||||||
WindowAcceptRegion(
|
WindowAcceptRegion(
|
||||||
size: Size(100, 32),
|
size: Size(100, 32),
|
||||||
@@ -249,18 +247,17 @@ class _RenderWindowGroupState extends State<RenderWindowGroup> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
color: _theme?.tabIconColor ?? Colors.white,
|
color: _theme.tabIconColor ?? Colors.white,
|
||||||
iconSize: 18,
|
iconSize: 18,
|
||||||
icon: Icon(widget.minimize ? Icons.minimize : Icons.fullscreen),
|
icon: Icon(widget.minimize ? Icons.minimize : Icons.fullscreen),
|
||||||
onPressed: widget.onFullScreen,
|
onPressed: widget.onFullScreen,
|
||||||
),
|
),
|
||||||
if (widget.onClose != null)
|
IconButton(
|
||||||
IconButton(
|
color: _theme.tabIconColor ?? Colors.white,
|
||||||
color: _theme?.tabIconColor ?? Colors.white,
|
iconSize: 18,
|
||||||
iconSize: 18,
|
icon: Icon(Icons.close),
|
||||||
icon: Icon(Icons.close),
|
onPressed: widget.onClose,
|
||||||
onPressed: widget.onClose,
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ class MyApp extends StatelessWidget {
|
|||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
title: 'Flutter Icon Resizer',
|
title: 'Flutter Icon Resizer',
|
||||||
theme: ThemeData.light().copyWith(
|
theme: ThemeData.light().copyWith(
|
||||||
primaryColor: Colors.blue,
|
primaryColor: Colors.blue, colorScheme: ColorScheme.fromSwatch().copyWith(secondary: Colors.red),
|
||||||
accentColor: Colors.red,
|
|
||||||
),
|
),
|
||||||
darkTheme: ThemeData.dark(),
|
darkTheme: ThemeData.dark(),
|
||||||
home: HomeScreen(),
|
home: HomeScreen(),
|
||||||
@@ -179,10 +178,8 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
Uri dataUrl;
|
Uri dataUrl;
|
||||||
try {
|
try {
|
||||||
if (binaryData != null) {
|
dataUrl = Uri.dataFromBytes(binaryData);
|
||||||
dataUrl = Uri.dataFromBytes(binaryData);
|
} catch (e) {
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
if (!silentErrors) {
|
if (!silentErrors) {
|
||||||
throw Exception("Error Creating File Data: $e");
|
throw Exception("Error Creating File Data: $e");
|
||||||
}
|
}
|
||||||
@@ -315,7 +312,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
SwitchListTile(
|
SwitchListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
'Export $name Icons',
|
'Export $name Icons',
|
||||||
style: Theme.of(context).textTheme.headline4,
|
style: Theme.of(context).textTheme.headlineMedium,
|
||||||
),
|
),
|
||||||
value: toggle,
|
value: toggle,
|
||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
@@ -338,27 +335,27 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
DataTable(
|
DataTable(
|
||||||
columns: [
|
columns: [
|
||||||
DataColumn(label: Text('Size')),
|
DataColumn(label: Text('Size')),
|
||||||
if (icons is List<IosIcon>) ...[
|
...[
|
||||||
DataColumn(label: Text('Prefix')),
|
DataColumn(label: Text('Prefix')),
|
||||||
DataColumn(label: Text('Ext')),
|
DataColumn(label: Text('Ext')),
|
||||||
DataColumn(label: Text('Scale')),
|
DataColumn(label: Text('Scale')),
|
||||||
DataColumn(label: Text('Point5')),
|
DataColumn(label: Text('Point5')),
|
||||||
],
|
],
|
||||||
if (icons is List<MacOSIcon>) ...[
|
...[
|
||||||
DataColumn(label: Text('Prefix')),
|
DataColumn(label: Text('Prefix')),
|
||||||
DataColumn(label: Text('Ext')),
|
DataColumn(label: Text('Ext')),
|
||||||
DataColumn(label: Text('Scale')),
|
DataColumn(label: Text('Scale')),
|
||||||
],
|
],
|
||||||
if (icons is List<WebIcon>) ...[
|
...[
|
||||||
DataColumn(label: Text('Prefix')),
|
DataColumn(label: Text('Prefix')),
|
||||||
DataColumn(label: Text('Ext')),
|
DataColumn(label: Text('Ext')),
|
||||||
],
|
],
|
||||||
if (icons is List<AndroidIcon>) ...[
|
...[
|
||||||
DataColumn(label: Text('Name')),
|
DataColumn(label: Text('Name')),
|
||||||
DataColumn(label: Text('Folder')),
|
DataColumn(label: Text('Folder')),
|
||||||
DataColumn(label: Text('Suffix')),
|
DataColumn(label: Text('Suffix')),
|
||||||
DataColumn(label: Text('Ext')),
|
DataColumn(label: Text('Ext')),
|
||||||
],
|
],
|
||||||
DataColumn(label: Text('Delete')),
|
DataColumn(label: Text('Delete')),
|
||||||
],
|
],
|
||||||
rows: [
|
rows: [
|
||||||
@@ -396,258 +393,258 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (icons is List<IosIcon>) ...[
|
...[
|
||||||
DataCell(
|
DataCell(
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 100,
|
width: 100,
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
decoration: InputDecoration.collapsed(
|
decoration: InputDecoration.collapsed(
|
||||||
hintText: 'Prefix',
|
hintText: 'Prefix',
|
||||||
),
|
|
||||||
initialValue: icons[i].prefix,
|
|
||||||
onChanged: (val) {
|
|
||||||
try {
|
|
||||||
if (mounted)
|
|
||||||
setState(() {
|
|
||||||
icons[i] = icons[i].copyWith(prefix: val);
|
|
||||||
});
|
|
||||||
} catch (e) {}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
initialValue: icons[i].prefix,
|
||||||
),
|
|
||||||
DataCell(
|
|
||||||
SizedBox(
|
|
||||||
width: 100,
|
|
||||||
child: TextFormField(
|
|
||||||
decoration: InputDecoration.collapsed(
|
|
||||||
hintText: 'Ext',
|
|
||||||
),
|
|
||||||
initialValue: icons[i].ext,
|
|
||||||
onChanged: (val) {
|
|
||||||
try {
|
|
||||||
if (mounted)
|
|
||||||
setState(() {
|
|
||||||
icons[i] = icons[i].copyWith(ext: val);
|
|
||||||
});
|
|
||||||
} catch (e) {}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
DataCell(
|
|
||||||
SizedBox(
|
|
||||||
width: 100,
|
|
||||||
child: TextFormField(
|
|
||||||
decoration: InputDecoration.collapsed(
|
|
||||||
hintText: 'Scale',
|
|
||||||
),
|
|
||||||
initialValue: icons[i].scale.toString(),
|
|
||||||
onChanged: (val) {
|
|
||||||
try {
|
|
||||||
if (mounted)
|
|
||||||
setState(() {
|
|
||||||
final _value = int.tryParse(val);
|
|
||||||
icons[i] =
|
|
||||||
icons[i].copyWith(scale: _value);
|
|
||||||
});
|
|
||||||
} catch (e) {}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
DataCell(
|
|
||||||
Switch(
|
|
||||||
value: icons[i].point5,
|
|
||||||
onChanged: (val) {
|
onChanged: (val) {
|
||||||
if (mounted)
|
try {
|
||||||
setState(() {
|
if (mounted)
|
||||||
icons[i] = icons[i].copyWith(point5: val);
|
setState(() {
|
||||||
});
|
icons[i] = icons[i].copyWith(prefix: val);
|
||||||
|
});
|
||||||
|
} catch (e) {}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
if (icons is List<MacOSIcon>) ...[
|
DataCell(
|
||||||
DataCell(
|
SizedBox(
|
||||||
SizedBox(
|
width: 100,
|
||||||
width: 100,
|
child: TextFormField(
|
||||||
child: TextFormField(
|
decoration: InputDecoration.collapsed(
|
||||||
decoration: InputDecoration.collapsed(
|
hintText: 'Ext',
|
||||||
hintText: 'Prefix',
|
|
||||||
),
|
|
||||||
initialValue: icons[i].prefix,
|
|
||||||
onChanged: (val) {
|
|
||||||
try {
|
|
||||||
if (mounted)
|
|
||||||
setState(() {
|
|
||||||
icons[i] = icons[i].copyWith(prefix: val);
|
|
||||||
});
|
|
||||||
} catch (e) {}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
initialValue: icons[i].ext,
|
||||||
|
onChanged: (val) {
|
||||||
|
try {
|
||||||
|
if (mounted)
|
||||||
|
setState(() {
|
||||||
|
icons[i] = icons[i].copyWith(ext: val);
|
||||||
|
});
|
||||||
|
} catch (e) {}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
DataCell(
|
),
|
||||||
SizedBox(
|
DataCell(
|
||||||
width: 100,
|
SizedBox(
|
||||||
child: TextFormField(
|
width: 100,
|
||||||
decoration: InputDecoration.collapsed(
|
child: TextFormField(
|
||||||
hintText: 'Ext',
|
decoration: InputDecoration.collapsed(
|
||||||
),
|
hintText: 'Scale',
|
||||||
initialValue: icons[i].ext,
|
|
||||||
onChanged: (val) {
|
|
||||||
try {
|
|
||||||
if (mounted)
|
|
||||||
setState(() {
|
|
||||||
icons[i] = icons[i].copyWith(ext: val);
|
|
||||||
});
|
|
||||||
} catch (e) {}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
initialValue: icons[i].scale.toString(),
|
||||||
|
onChanged: (val) {
|
||||||
|
try {
|
||||||
|
if (mounted)
|
||||||
|
setState(() {
|
||||||
|
final _value = int.tryParse(val);
|
||||||
|
icons[i] =
|
||||||
|
icons[i].copyWith(scale: _value);
|
||||||
|
});
|
||||||
|
} catch (e) {}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
DataCell(
|
),
|
||||||
SizedBox(
|
DataCell(
|
||||||
width: 100,
|
Switch(
|
||||||
child: TextFormField(
|
value: icons[i].point5,
|
||||||
decoration: InputDecoration.collapsed(
|
onChanged: (val) {
|
||||||
hintText: 'Scale',
|
if (mounted)
|
||||||
),
|
setState(() {
|
||||||
initialValue: icons[i].scale.toString(),
|
icons[i] = icons[i].copyWith(point5: val);
|
||||||
onChanged: (val) {
|
});
|
||||||
try {
|
},
|
||||||
if (mounted)
|
),
|
||||||
setState(() {
|
),
|
||||||
final _value = int.tryParse(val);
|
],
|
||||||
icons[i] =
|
...[
|
||||||
icons[i].copyWith(scale: _value);
|
DataCell(
|
||||||
});
|
SizedBox(
|
||||||
} catch (e) {}
|
width: 100,
|
||||||
},
|
child: TextFormField(
|
||||||
|
decoration: InputDecoration.collapsed(
|
||||||
|
hintText: 'Prefix',
|
||||||
),
|
),
|
||||||
|
initialValue: icons[i].prefix,
|
||||||
|
onChanged: (val) {
|
||||||
|
try {
|
||||||
|
if (mounted)
|
||||||
|
setState(() {
|
||||||
|
icons[i] = icons[i].copyWith(prefix: val);
|
||||||
|
});
|
||||||
|
} catch (e) {}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
if (icons is List<WebIcon>) ...[
|
DataCell(
|
||||||
DataCell(
|
SizedBox(
|
||||||
SizedBox(
|
width: 100,
|
||||||
width: 100,
|
child: TextFormField(
|
||||||
child: TextFormField(
|
decoration: InputDecoration.collapsed(
|
||||||
decoration: InputDecoration.collapsed(
|
hintText: 'Ext',
|
||||||
hintText: 'Prefix',
|
|
||||||
),
|
|
||||||
initialValue: icons[i].prefix,
|
|
||||||
onChanged: (val) {
|
|
||||||
try {
|
|
||||||
if (mounted)
|
|
||||||
setState(() {
|
|
||||||
icons[i] = icons[i].copyWith(prefix: val);
|
|
||||||
});
|
|
||||||
} catch (e) {}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
initialValue: icons[i].ext,
|
||||||
|
onChanged: (val) {
|
||||||
|
try {
|
||||||
|
if (mounted)
|
||||||
|
setState(() {
|
||||||
|
icons[i] = icons[i].copyWith(ext: val);
|
||||||
|
});
|
||||||
|
} catch (e) {}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
DataCell(
|
),
|
||||||
SizedBox(
|
DataCell(
|
||||||
width: 100,
|
SizedBox(
|
||||||
child: TextFormField(
|
width: 100,
|
||||||
decoration: InputDecoration.collapsed(
|
child: TextFormField(
|
||||||
hintText: 'Ext',
|
decoration: InputDecoration.collapsed(
|
||||||
),
|
hintText: 'Scale',
|
||||||
initialValue: icons[i].ext,
|
|
||||||
onChanged: (val) {
|
|
||||||
try {
|
|
||||||
if (mounted)
|
|
||||||
setState(() {
|
|
||||||
icons[i] = icons[i].copyWith(ext: val);
|
|
||||||
});
|
|
||||||
} catch (e) {}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
initialValue: icons[i].scale.toString(),
|
||||||
|
onChanged: (val) {
|
||||||
|
try {
|
||||||
|
if (mounted)
|
||||||
|
setState(() {
|
||||||
|
final _value = int.tryParse(val);
|
||||||
|
icons[i] =
|
||||||
|
icons[i].copyWith(scale: _value);
|
||||||
|
});
|
||||||
|
} catch (e) {}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
if (icons is List<AndroidIcon>) ...[
|
],
|
||||||
DataCell(
|
...[
|
||||||
SizedBox(
|
DataCell(
|
||||||
width: 100,
|
SizedBox(
|
||||||
child: TextFormField(
|
width: 100,
|
||||||
decoration: InputDecoration.collapsed(
|
child: TextFormField(
|
||||||
hintText: 'Name',
|
decoration: InputDecoration.collapsed(
|
||||||
),
|
hintText: 'Prefix',
|
||||||
initialValue: icons[i].name,
|
|
||||||
onChanged: (val) {
|
|
||||||
try {
|
|
||||||
if (mounted)
|
|
||||||
setState(() {
|
|
||||||
icons[i] = icons[i].copyWith(name: val);
|
|
||||||
});
|
|
||||||
} catch (e) {}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
initialValue: icons[i].prefix,
|
||||||
|
onChanged: (val) {
|
||||||
|
try {
|
||||||
|
if (mounted)
|
||||||
|
setState(() {
|
||||||
|
icons[i] = icons[i].copyWith(prefix: val);
|
||||||
|
});
|
||||||
|
} catch (e) {}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
DataCell(
|
),
|
||||||
SizedBox(
|
DataCell(
|
||||||
width: 100,
|
SizedBox(
|
||||||
child: TextFormField(
|
width: 100,
|
||||||
decoration: InputDecoration.collapsed(
|
child: TextFormField(
|
||||||
hintText: 'Folder',
|
decoration: InputDecoration.collapsed(
|
||||||
),
|
hintText: 'Ext',
|
||||||
initialValue: icons[i].folder,
|
|
||||||
onChanged: (val) {
|
|
||||||
try {
|
|
||||||
if (mounted)
|
|
||||||
setState(() {
|
|
||||||
icons[i] = icons[i].copyWith(folder: val);
|
|
||||||
});
|
|
||||||
} catch (e) {}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
initialValue: icons[i].ext,
|
||||||
|
onChanged: (val) {
|
||||||
|
try {
|
||||||
|
if (mounted)
|
||||||
|
setState(() {
|
||||||
|
icons[i] = icons[i].copyWith(ext: val);
|
||||||
|
});
|
||||||
|
} catch (e) {}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
DataCell(
|
),
|
||||||
SizedBox(
|
],
|
||||||
width: 100,
|
...[
|
||||||
child: TextFormField(
|
DataCell(
|
||||||
decoration: InputDecoration.collapsed(
|
SizedBox(
|
||||||
hintText: 'Suffix',
|
width: 100,
|
||||||
),
|
child: TextFormField(
|
||||||
initialValue: icons[i].folderSuffix,
|
decoration: InputDecoration.collapsed(
|
||||||
onChanged: (val) {
|
hintText: 'Name',
|
||||||
try {
|
|
||||||
if (mounted)
|
|
||||||
setState(() {
|
|
||||||
icons[i] =
|
|
||||||
icons[i].copyWith(folderSuffix: val);
|
|
||||||
});
|
|
||||||
} catch (e) {}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
initialValue: icons[i].name,
|
||||||
|
onChanged: (val) {
|
||||||
|
try {
|
||||||
|
if (mounted)
|
||||||
|
setState(() {
|
||||||
|
icons[i] = icons[i].copyWith(name: val);
|
||||||
|
});
|
||||||
|
} catch (e) {}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
DataCell(
|
),
|
||||||
SizedBox(
|
DataCell(
|
||||||
width: 100,
|
SizedBox(
|
||||||
child: TextFormField(
|
width: 100,
|
||||||
decoration: InputDecoration.collapsed(
|
child: TextFormField(
|
||||||
hintText: 'Ext',
|
decoration: InputDecoration.collapsed(
|
||||||
),
|
hintText: 'Folder',
|
||||||
initialValue: icons[i].ext,
|
|
||||||
onChanged: (val) {
|
|
||||||
try {
|
|
||||||
if (mounted)
|
|
||||||
setState(() {
|
|
||||||
icons[i] = icons[i].copyWith(ext: val);
|
|
||||||
});
|
|
||||||
} catch (e) {}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
initialValue: icons[i].folder,
|
||||||
|
onChanged: (val) {
|
||||||
|
try {
|
||||||
|
if (mounted)
|
||||||
|
setState(() {
|
||||||
|
icons[i] = icons[i].copyWith(folder: val);
|
||||||
|
});
|
||||||
|
} catch (e) {}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
|
DataCell(
|
||||||
|
SizedBox(
|
||||||
|
width: 100,
|
||||||
|
child: TextFormField(
|
||||||
|
decoration: InputDecoration.collapsed(
|
||||||
|
hintText: 'Suffix',
|
||||||
|
),
|
||||||
|
initialValue: icons[i].folderSuffix,
|
||||||
|
onChanged: (val) {
|
||||||
|
try {
|
||||||
|
if (mounted)
|
||||||
|
setState(() {
|
||||||
|
icons[i] =
|
||||||
|
icons[i].copyWith(folderSuffix: val);
|
||||||
|
});
|
||||||
|
} catch (e) {}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
DataCell(
|
||||||
|
SizedBox(
|
||||||
|
width: 100,
|
||||||
|
child: TextFormField(
|
||||||
|
decoration: InputDecoration.collapsed(
|
||||||
|
hintText: 'Ext',
|
||||||
|
),
|
||||||
|
initialValue: icons[i].ext,
|
||||||
|
onChanged: (val) {
|
||||||
|
try {
|
||||||
|
if (mounted)
|
||||||
|
setState(() {
|
||||||
|
icons[i] = icons[i].copyWith(ext: val);
|
||||||
|
});
|
||||||
|
} catch (e) {}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
DataCell(
|
DataCell(
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(Icons.delete),
|
icon: Icon(Icons.delete),
|
||||||
@@ -668,39 +665,31 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (mounted)
|
if (mounted)
|
||||||
setState(() {
|
setState(() {
|
||||||
if (icons is List<IosIcon>) {
|
icons.add(
|
||||||
icons.add(
|
IosIcon(
|
||||||
IosIcon(
|
size: 1024,
|
||||||
size: 1024,
|
scale: 1,
|
||||||
scale: 1,
|
),
|
||||||
),
|
);
|
||||||
);
|
icons.add(
|
||||||
}
|
WebIcon(
|
||||||
if (icons is List<WebIcon>) {
|
size: 192,
|
||||||
icons.add(
|
),
|
||||||
WebIcon(
|
);
|
||||||
size: 192,
|
icons.add(
|
||||||
),
|
MacOSIcon(
|
||||||
);
|
size: 512,
|
||||||
}
|
scale: 2,
|
||||||
if (icons is List<MacOSIcon>) {
|
name: '1024',
|
||||||
icons.add(
|
),
|
||||||
MacOSIcon(
|
);
|
||||||
size: 512,
|
icons.add(
|
||||||
scale: 2,
|
AndroidIcon(
|
||||||
name: '1024',
|
size: 192,
|
||||||
),
|
folderSuffix: "xxxhdpi",
|
||||||
);
|
),
|
||||||
}
|
);
|
||||||
if (icons is List<AndroidIcon>) {
|
});
|
||||||
icons.add(
|
|
||||||
AndroidIcon(
|
|
||||||
size: 192,
|
|
||||||
folderSuffix: "xxxhdpi",
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -711,9 +700,6 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildFilePreview() {
|
Widget _buildFilePreview() {
|
||||||
if (_files == null) {
|
|
||||||
return Center(child: CircularProgressIndicator());
|
|
||||||
}
|
|
||||||
return ListView.separated(
|
return ListView.separated(
|
||||||
separatorBuilder: (context, index) => Container(
|
separatorBuilder: (context, index) => Container(
|
||||||
height: 1.0,
|
height: 1.0,
|
||||||
@@ -729,7 +715,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
_key,
|
_key,
|
||||||
style: Theme.of(context).textTheme.headline4,
|
style: Theme.of(context).textTheme.headlineMedium,
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,7 @@ void _setTargetPlatformForDesktop() {
|
|||||||
} else if (Platform.isLinux || Platform.isWindows) {
|
} else if (Platform.isLinux || Platform.isWindows) {
|
||||||
targetPlatform = TargetPlatform.android;
|
targetPlatform = TargetPlatform.android;
|
||||||
}
|
}
|
||||||
if (targetPlatform != null) {
|
debugDefaultTargetPlatformOverride = targetPlatform;
|
||||||
debugDefaultTargetPlatformOverride = targetPlatform;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatefulWidget {
|
class MyApp extends StatefulWidget {
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class _MobilePopUpState extends State<MobilePopUp> {
|
|||||||
void init() {
|
void init() {
|
||||||
if (mounted)
|
if (mounted)
|
||||||
setState(() {
|
setState(() {
|
||||||
leadingColor = widget?.leadingColor;
|
leadingColor = widget.leadingColor;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,10 +88,10 @@ class _MobilePopUpState extends State<MobilePopUp> {
|
|||||||
_size.height < widget.breakpoint.height;
|
_size.height < widget.breakpoint.height;
|
||||||
final _full = _mobile || fullscreen;
|
final _full = _mobile || fullscreen;
|
||||||
final _content = _PopUpContent(
|
final _content = _PopUpContent(
|
||||||
title: widget?.title,
|
title: widget.title,
|
||||||
showDoneButton: widget.showDoneButton,
|
showDoneButton: widget.showDoneButton,
|
||||||
child: widget?.child,
|
child: widget.child,
|
||||||
routes: widget?.routes,
|
routes: widget.routes,
|
||||||
leadingColor: leadingColor,
|
leadingColor: leadingColor,
|
||||||
fullscreen: !widget.showFullScreen ? null : fullscreen,
|
fullscreen: !widget.showFullScreen ? null : fullscreen,
|
||||||
toggleFullscreen: (value) {
|
toggleFullscreen: (value) {
|
||||||
@@ -155,14 +155,13 @@ class _PopUpContent extends StatelessWidget {
|
|||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
if (fullscreen != null)
|
IconButton(
|
||||||
IconButton(
|
icon:
|
||||||
icon:
|
Icon(fullscreen ? Icons.fullscreen_exit : Icons.fullscreen),
|
||||||
Icon(fullscreen ? Icons.fullscreen_exit : Icons.fullscreen),
|
onPressed: () => toggleFullscreen(!fullscreen),
|
||||||
onPressed: () => toggleFullscreen(!fullscreen),
|
)
|
||||||
)
|
|
||||||
],
|
],
|
||||||
title: title == null ? null : Text(title),
|
title: Text(title),
|
||||||
),
|
),
|
||||||
body: child,
|
body: child,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ Future<T> showMobilePopup<T>({
|
|||||||
Animation<double> secondaryAnimation) {
|
Animation<double> secondaryAnimation) {
|
||||||
final Widget pageChild = Builder(builder: builder);
|
final Widget pageChild = Builder(builder: builder);
|
||||||
return Builder(builder: (BuildContext context) {
|
return Builder(builder: (BuildContext context) {
|
||||||
return theme != null ? Theme(data: theme, child: pageChild) : pageChild;
|
return Theme(data: theme, child: pageChild);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
barrierDismissible: barrierDismissible,
|
barrierDismissible: barrierDismissible,
|
||||||
|
|||||||
@@ -151,9 +151,6 @@ class FancyTitle extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (logo == null) {
|
|
||||||
return logo;
|
|
||||||
}
|
|
||||||
return Row(
|
return Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
logo,
|
logo,
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
import 'dart:math';
|
|
||||||
|
|
||||||
import 'package:auto_size_text/auto_size_text.dart';
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
|
||||||
|
|
||||||
class TabChild {
|
class TabChild {
|
||||||
final String title;
|
final String title;
|
||||||
@@ -72,15 +69,13 @@ class MobileSidebar extends StatelessWidget {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
key: _scaffoldKey,
|
key: _scaffoldKey,
|
||||||
drawer: _showDrawer
|
drawer: _showDrawer
|
||||||
? drawerBuilder != null
|
? drawerBuilder(context, _titles, onTabChanged)
|
||||||
? drawerBuilder(context, _titles, onTabChanged)
|
|
||||||
: _buildDrawer(context, _titles)
|
|
||||||
: null,
|
: null,
|
||||||
appBar: PreferredSize(
|
appBar: PreferredSize(
|
||||||
preferredSize: Size.fromHeight(kToolbarHeight),
|
preferredSize: Size.fromHeight(kToolbarHeight),
|
||||||
child: Material(
|
child: Material(
|
||||||
color: theme.appBarTheme.color,
|
color: theme.appBarTheme.color,
|
||||||
elevation: theme.appBarTheme?.elevation ?? 4.0,
|
elevation: theme.appBarTheme.elevation ?? 4.0,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@@ -187,8 +182,8 @@ class MobileSidebar extends StatelessWidget {
|
|||||||
if (showSearchButton) ...[
|
if (showSearchButton) ...[
|
||||||
_searchBuilder(context, _showDrawer),
|
_searchBuilder(context, _showDrawer),
|
||||||
],
|
],
|
||||||
if (ctaBuilder != null) ctaBuilder(context),
|
ctaBuilder(context),
|
||||||
if (accountBuilder != null) accountBuilder(context),
|
accountBuilder(context),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -216,7 +211,7 @@ class MobileSidebar extends StatelessWidget {
|
|||||||
child: Center(
|
child: Center(
|
||||||
child: AutoSizeText(
|
child: AutoSizeText(
|
||||||
tab,
|
tab,
|
||||||
style: theme.textTheme.body2.copyWith(
|
style: theme.textTheme.bodyLarge.copyWith(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -227,7 +222,7 @@ class MobileSidebar extends StatelessWidget {
|
|||||||
height: kBarHeight,
|
height: kBarHeight,
|
||||||
width: tabWidth * 2,
|
width: tabWidth * 2,
|
||||||
color: tab == _titles[currentIndex]
|
color: tab == _titles[currentIndex]
|
||||||
? theme.accentColor
|
? theme.colorScheme.secondary
|
||||||
: Colors.transparent,
|
: Colors.transparent,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -239,10 +234,8 @@ class MobileSidebar extends StatelessWidget {
|
|||||||
final kBarHeight = 3.0;
|
final kBarHeight = 3.0;
|
||||||
|
|
||||||
Widget _menuIconBuilder(BuildContext context) {
|
Widget _menuIconBuilder(BuildContext context) {
|
||||||
if (menuButtonBuilder != null) {
|
return menuButtonBuilder(context);
|
||||||
return menuButtonBuilder(context);
|
return IconButton(
|
||||||
}
|
|
||||||
return IconButton(
|
|
||||||
icon: Icon(Icons.menu),
|
icon: Icon(Icons.menu),
|
||||||
onPressed: () => _scaffoldKey.currentState.openDrawer(),
|
onPressed: () => _scaffoldKey.currentState.openDrawer(),
|
||||||
);
|
);
|
||||||
@@ -250,22 +243,16 @@ class MobileSidebar extends StatelessWidget {
|
|||||||
|
|
||||||
Widget _searchBuilder(BuildContext context, bool showDrawer) {
|
Widget _searchBuilder(BuildContext context, bool showDrawer) {
|
||||||
if (showDrawer) {
|
if (showDrawer) {
|
||||||
if (searchIconBuilder != null) {
|
return searchIconBuilder(context);
|
||||||
return searchIconBuilder(context);
|
return IconButton(
|
||||||
}
|
|
||||||
return IconButton(
|
|
||||||
icon: Icon(Icons.search),
|
icon: Icon(Icons.search),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (isSearchChanged != null) {
|
isSearchChanged(!isSearching);
|
||||||
isSearchChanged(!isSearching);
|
},
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (searchBarBuilder != null) {
|
return searchBarBuilder(context, searchChanged);
|
||||||
return searchBarBuilder(context, searchChanged);
|
const kSearchBarWidth = 225.0;
|
||||||
}
|
|
||||||
const kSearchBarWidth = 225.0;
|
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
width: kSearchBarWidth,
|
width: kSearchBarWidth,
|
||||||
@@ -289,10 +276,8 @@ class MobileSidebar extends StatelessWidget {
|
|||||||
onTap: isSearching
|
onTap: isSearching
|
||||||
? null
|
? null
|
||||||
: () {
|
: () {
|
||||||
if (isSearchChanged != null) {
|
isSearchChanged(!isSearching);
|
||||||
isSearchChanged(!isSearching);
|
},
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -345,10 +330,10 @@ class MobileSidebar extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
_divider,
|
_divider,
|
||||||
if (ctaBuilder != null) ...[
|
...[
|
||||||
ctaBuilder(context),
|
ctaBuilder(context),
|
||||||
_divider,
|
_divider,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class MyApp extends StatelessWidget {
|
|||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
title: 'NavigationRail Demo',
|
title: 'NavigationRail Demo',
|
||||||
theme: _theme(ThemeData.light().copyWith(
|
theme: _theme(ThemeData.light().copyWith(
|
||||||
accentColor: Colors.red,
|
colorScheme: ColorScheme.fromSwatch().copyWith(secondary: Colors.red),
|
||||||
)),
|
)),
|
||||||
darkTheme: ThemeData.dark(),
|
darkTheme: ThemeData.dark(),
|
||||||
home: Directionality(
|
home: Directionality(
|
||||||
@@ -26,7 +26,7 @@ class MyApp extends StatelessWidget {
|
|||||||
appBarTheme: base.appBarTheme.copyWith(elevation: 0.0),
|
appBarTheme: base.appBarTheme.copyWith(elevation: 0.0),
|
||||||
floatingActionButtonTheme: base.floatingActionButtonTheme.copyWith(
|
floatingActionButtonTheme: base.floatingActionButtonTheme.copyWith(
|
||||||
elevation: 2.0,
|
elevation: 2.0,
|
||||||
backgroundColor: base.accentColor,
|
backgroundColor: base.colorScheme.secondary,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -96,19 +96,19 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
),
|
),
|
||||||
tabs: <BottomNavigationBarItem>[
|
tabs: <BottomNavigationBarItem>[
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
title: Text("Folders"),
|
label: Text("Folders"),
|
||||||
icon: Icon(Icons.folder),
|
icon: Icon(Icons.folder),
|
||||||
),
|
),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
title: Text("History"),
|
label: Text("History"),
|
||||||
icon: Icon(Icons.history),
|
icon: Icon(Icons.history),
|
||||||
),
|
),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
title: Text("Gallery"),
|
label: Text("Gallery"),
|
||||||
icon: Icon(Icons.photo_library),
|
icon: Icon(Icons.photo_library),
|
||||||
),
|
),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
title: Text("Camera"),
|
label: Text("Camera"),
|
||||||
icon: Icon(Icons.camera),
|
icon: Icon(Icons.camera),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -144,10 +144,10 @@ class NavRail extends StatelessWidget {
|
|||||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
minWidth: isDense ? _denseRailSize : _railSize,
|
minWidth: isDense ? _denseRailSize : _railSize,
|
||||||
selectedIconTheme: IconThemeData(
|
selectedIconTheme: IconThemeData(
|
||||||
color: Theme.of(context).accentColor,
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
),
|
),
|
||||||
selectedLabelTextStyle: TextStyle(
|
selectedLabelTextStyle: TextStyle(
|
||||||
color: Theme.of(context).accentColor,
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
),
|
),
|
||||||
unselectedIconTheme: IconThemeData(
|
unselectedIconTheme: IconThemeData(
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
@@ -157,7 +157,7 @@ class NavRail extends StatelessWidget {
|
|||||||
onDestinationSelected: (val) => onTap(val),
|
onDestinationSelected: (val) => onTap(val),
|
||||||
destinations: tabs
|
destinations: tabs
|
||||||
.map((e) => NavigationRailDestination(
|
.map((e) => NavigationRailDestination(
|
||||||
label: e.title,
|
label: e.label,
|
||||||
icon: e.icon,
|
icon: e.icon,
|
||||||
))
|
))
|
||||||
.toList(),
|
.toList(),
|
||||||
@@ -169,15 +169,15 @@ class NavRail extends StatelessWidget {
|
|||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
if (drawerHeaderBuilder != null) ...[
|
...[
|
||||||
drawerHeaderBuilder(context),
|
drawerHeaderBuilder(context),
|
||||||
],
|
],
|
||||||
if (showTabs) ...[
|
if (showTabs) ...[
|
||||||
Expanded(child: buildRail(context, true)),
|
Expanded(child: buildRail(context, true)),
|
||||||
],
|
],
|
||||||
if (drawerFooterBuilder != null) ...[
|
...[
|
||||||
drawerFooterBuilder(context),
|
drawerFooterBuilder(context),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -114,15 +114,13 @@ class MyApp extends StatelessWidget {
|
|||||||
""";
|
""";
|
||||||
|
|
||||||
String buildCustomColors(List<CustomColor> colors) {
|
String buildCustomColors(List<CustomColor> colors) {
|
||||||
if (colors != null) {
|
final sb = StringBuffer();
|
||||||
final sb = StringBuffer();
|
for (var color in colors) {
|
||||||
for (var color in colors) {
|
String _name = ReCase(color.name).camelCase;
|
||||||
String _name = ReCase(color.name).camelCase;
|
int _value = color.color;
|
||||||
int _value = color.color;
|
sb.writeln(' static Color get $_name => const Color($_value);');
|
||||||
sb.writeln(' static Color get $_name => const Color($_value);');
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
|
return sb.toString();
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,52 +132,42 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
bool isDark(BuildContext context) => Theme.of(context).brightness == Brightness.dark;
|
bool isDark(BuildContext context) => Theme.of(context).brightness == Brightness.dark;
|
||||||
|
|
||||||
ThemeMode get themeMode => ${(project?.themeMode ?? ThemeMode.system).toString()};
|
ThemeMode get themeMode => ${(project.themeMode ?? ThemeMode.system).toString()};
|
||||||
|
|
||||||
""");
|
""");
|
||||||
|
|
||||||
sb.writeln(_writeProjectTheme(project?.lightTheme, 'LightTheme', true));
|
sb.writeln(_writeProjectTheme(project.lightTheme, 'LightTheme', true));
|
||||||
sb.writeln(_writeProjectTheme(project?.darkTheme, 'DarkTheme', false));
|
sb.writeln(_writeProjectTheme(project.darkTheme, 'DarkTheme', false));
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
String _writeProjectTheme(ProjectTheme theme, String name, bool isLight) {
|
String _writeProjectTheme(ProjectTheme theme, String name, bool isLight) {
|
||||||
if (theme == null) {
|
|
||||||
return """
|
|
||||||
class $name {
|
|
||||||
$name._();
|
|
||||||
|
|
||||||
static ThemeData get data => ThemeData.${isLight ? 'light' : 'dark'}();
|
|
||||||
|
|
||||||
}
|
|
||||||
""";
|
|
||||||
}
|
|
||||||
ThemeData _base = isLight ? ThemeData.light() : ThemeData.dark();
|
ThemeData _base = isLight ? ThemeData.light() : ThemeData.dark();
|
||||||
return """
|
return """
|
||||||
class $name {
|
class $name {
|
||||||
$name._();
|
$name._();
|
||||||
|
|
||||||
static ThemeData get data => ThemeData(
|
static ThemeData get data => ThemeData(
|
||||||
brightness: ${theme?.lightBrightness ?? isLight ? 'Brightness.light' : 'Brightness.dark'},
|
brightness: ${theme.lightBrightness ?? isLight ? 'Brightness.light' : 'Brightness.dark'},
|
||||||
visualDensity: VisualDensity.adaptivePlatformDensity,
|
visualDensity: VisualDensity.adaptivePlatformDensity,
|
||||||
textTheme: ThemeData.${isLight ? 'light' : 'dark'}().textTheme
|
textTheme: ThemeData.${isLight ? 'light' : 'dark'}().textTheme
|
||||||
).copyWith(
|
).copyWith(
|
||||||
primaryColor: const Color(${_getColor(theme?.primaryColor, _base.primaryColor)}),
|
primaryColor: const Color(${_getColor(theme.primaryColor, _base.primaryColor)}),
|
||||||
accentColor: const Color(${_getColor(theme?.accentColor, _base.accentColor)}),
|
accentColor: const Color(${_getColor(theme.accentColor, _base.colorScheme.secondary)}),
|
||||||
floatingActionButtonTheme:
|
floatingActionButtonTheme:
|
||||||
ThemeData.${isLight ? 'light' : 'dark'}().floatingActionButtonTheme.copyWith(
|
ThemeData.${isLight ? 'light' : 'dark'}().floatingActionButtonTheme.copyWith(
|
||||||
backgroundColor: const Color(${_getColor(theme?.floatingActionButtonBackgroundColor, _base.floatingActionButtonTheme.backgroundColor)}),
|
backgroundColor: const Color(${_getColor(theme.floatingActionButtonBackgroundColor, _base.floatingActionButtonTheme.backgroundColor)}),
|
||||||
foregroundColor: const Color(${_getColor(theme?.floatingActionButtonForegroundColor, _base.floatingActionButtonTheme.foregroundColor)}),
|
foregroundColor: const Color(${_getColor(theme.floatingActionButtonForegroundColor, _base.floatingActionButtonTheme.foregroundColor)}),
|
||||||
),
|
),
|
||||||
scaffoldBackgroundColor: const Color(${_getColor(theme?.scaffoldBackgroundColor, _base.scaffoldBackgroundColor)}),
|
scaffoldBackgroundColor: const Color(${_getColor(theme.scaffoldBackgroundColor, _base.scaffoldBackgroundColor)}),
|
||||||
appBarTheme: ThemeData.${isLight ? 'light' : 'dark'}().appBarTheme,
|
appBarTheme: ThemeData.${isLight ? 'light' : 'dark'}().appBarTheme,
|
||||||
);
|
);
|
||||||
|
|
||||||
${buildCustomColors(theme?.customColors)}
|
${buildCustomColors(theme.customColors)}
|
||||||
}
|
}
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
int _getColor(int value, Color fallback) {
|
int _getColor(int value, Color fallback) {
|
||||||
return value ?? fallback?.value ?? Colors.blue.value;
|
return value ?? fallback.value ?? Colors.blue.value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,10 +101,8 @@ Future _writeFilesDir(
|
|||||||
if (!_dir.existsSync()) {
|
if (!_dir.existsSync()) {
|
||||||
_dir.createSync(recursive: true);
|
_dir.createSync(recursive: true);
|
||||||
}
|
}
|
||||||
if (file?.children != null) {
|
await _writeFilesDir(file.children, path, base);
|
||||||
await _writeFilesDir(file.children, path, base);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -166,9 +166,6 @@ class _$FlutterProjectCopyWithImpl<$Res>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
$ProjectThemeCopyWith<$Res> get lightTheme {
|
$ProjectThemeCopyWith<$Res> get lightTheme {
|
||||||
if (_value.lightTheme == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return $ProjectThemeCopyWith<$Res>(_value.lightTheme, (value) {
|
return $ProjectThemeCopyWith<$Res>(_value.lightTheme, (value) {
|
||||||
return _then(_value.copyWith(lightTheme: value));
|
return _then(_value.copyWith(lightTheme: value));
|
||||||
});
|
});
|
||||||
@@ -176,9 +173,6 @@ class _$FlutterProjectCopyWithImpl<$Res>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
$ProjectThemeCopyWith<$Res> get darkTheme {
|
$ProjectThemeCopyWith<$Res> get darkTheme {
|
||||||
if (_value.darkTheme == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return $ProjectThemeCopyWith<$Res>(_value.darkTheme, (value) {
|
return $ProjectThemeCopyWith<$Res>(_value.darkTheme, (value) {
|
||||||
return _then(_value.copyWith(darkTheme: value));
|
return _then(_value.copyWith(darkTheme: value));
|
||||||
});
|
});
|
||||||
@@ -298,16 +292,7 @@ class _$_FlutterProject
|
|||||||
this.themeMode,
|
this.themeMode,
|
||||||
this.canvasZoom = 0,
|
this.canvasZoom = 0,
|
||||||
this.canvasOffsetDx = 0,
|
this.canvasOffsetDx = 0,
|
||||||
this.canvasOffsetDy = 0})
|
this.canvasOffsetDy = 0});
|
||||||
: assert(name != null),
|
|
||||||
assert(org != null),
|
|
||||||
assert(description != null),
|
|
||||||
assert(useSwift != null),
|
|
||||||
assert(useKotlin != null),
|
|
||||||
assert(targets != null),
|
|
||||||
assert(canvasZoom != null),
|
|
||||||
assert(canvasOffsetDx != null),
|
|
||||||
assert(canvasOffsetDy != null);
|
|
||||||
|
|
||||||
factory _$_FlutterProject.fromJson(Map<String, dynamic> json) =>
|
factory _$_FlutterProject.fromJson(Map<String, dynamic> json) =>
|
||||||
_$_$_FlutterProjectFromJson(json);
|
_$_$_FlutterProjectFromJson(json);
|
||||||
|
|||||||
@@ -750,9 +750,6 @@ class _$_CustomGradient
|
|||||||
double endY,
|
double endY,
|
||||||
TileMode tileMode),
|
TileMode tileMode),
|
||||||
}) {
|
}) {
|
||||||
assert($default != null);
|
|
||||||
assert(radial != null);
|
|
||||||
assert(linear != null);
|
|
||||||
return $default(name, colors);
|
return $default(name, colors);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -781,11 +778,8 @@ class _$_CustomGradient
|
|||||||
TileMode tileMode),
|
TileMode tileMode),
|
||||||
@required Result orElse(),
|
@required Result orElse(),
|
||||||
}) {
|
}) {
|
||||||
assert(orElse != null);
|
return $default(name, colors);
|
||||||
if ($default != null) {
|
return orElse();
|
||||||
return $default(name, colors);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -795,9 +789,6 @@ class _$_CustomGradient
|
|||||||
@required Result radial(CustomRadialGradient value),
|
@required Result radial(CustomRadialGradient value),
|
||||||
@required Result linear(CustomLinearGradient value),
|
@required Result linear(CustomLinearGradient value),
|
||||||
}) {
|
}) {
|
||||||
assert($default != null);
|
|
||||||
assert(radial != null);
|
|
||||||
assert(linear != null);
|
|
||||||
return $default(this);
|
return $default(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -809,11 +800,8 @@ class _$_CustomGradient
|
|||||||
Result linear(CustomLinearGradient value),
|
Result linear(CustomLinearGradient value),
|
||||||
@required Result orElse(),
|
@required Result orElse(),
|
||||||
}) {
|
}) {
|
||||||
assert(orElse != null);
|
return $default(this);
|
||||||
if ($default != null) {
|
return orElse();
|
||||||
return $default(this);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -1006,9 +994,6 @@ class _$CustomRadialGradient
|
|||||||
double endY,
|
double endY,
|
||||||
TileMode tileMode),
|
TileMode tileMode),
|
||||||
}) {
|
}) {
|
||||||
assert($default != null);
|
|
||||||
assert(radial != null);
|
|
||||||
assert(linear != null);
|
|
||||||
return radial(name, stops, colors, radius, alignX, alignY, focalX, focalY);
|
return radial(name, stops, colors, radius, alignX, alignY, focalX, focalY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1037,12 +1022,9 @@ class _$CustomRadialGradient
|
|||||||
TileMode tileMode),
|
TileMode tileMode),
|
||||||
@required Result orElse(),
|
@required Result orElse(),
|
||||||
}) {
|
}) {
|
||||||
assert(orElse != null);
|
return radial(
|
||||||
if (radial != null) {
|
name, stops, colors, radius, alignX, alignY, focalX, focalY);
|
||||||
return radial(
|
return orElse();
|
||||||
name, stops, colors, radius, alignX, alignY, focalX, focalY);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -1052,9 +1034,6 @@ class _$CustomRadialGradient
|
|||||||
@required Result radial(CustomRadialGradient value),
|
@required Result radial(CustomRadialGradient value),
|
||||||
@required Result linear(CustomLinearGradient value),
|
@required Result linear(CustomLinearGradient value),
|
||||||
}) {
|
}) {
|
||||||
assert($default != null);
|
|
||||||
assert(radial != null);
|
|
||||||
assert(linear != null);
|
|
||||||
return radial(this);
|
return radial(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1066,11 +1045,8 @@ class _$CustomRadialGradient
|
|||||||
Result linear(CustomLinearGradient value),
|
Result linear(CustomLinearGradient value),
|
||||||
@required Result orElse(),
|
@required Result orElse(),
|
||||||
}) {
|
}) {
|
||||||
assert(orElse != null);
|
return radial(this);
|
||||||
if (radial != null) {
|
return orElse();
|
||||||
return radial(this);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -1288,9 +1264,6 @@ class _$CustomLinearGradient
|
|||||||
double endY,
|
double endY,
|
||||||
TileMode tileMode),
|
TileMode tileMode),
|
||||||
}) {
|
}) {
|
||||||
assert($default != null);
|
|
||||||
assert(radial != null);
|
|
||||||
assert(linear != null);
|
|
||||||
return linear(
|
return linear(
|
||||||
name, stops, colors, radius, startX, startY, endX, endY, tileMode);
|
name, stops, colors, radius, startX, startY, endX, endY, tileMode);
|
||||||
}
|
}
|
||||||
@@ -1320,12 +1293,9 @@ class _$CustomLinearGradient
|
|||||||
TileMode tileMode),
|
TileMode tileMode),
|
||||||
@required Result orElse(),
|
@required Result orElse(),
|
||||||
}) {
|
}) {
|
||||||
assert(orElse != null);
|
return linear(
|
||||||
if (linear != null) {
|
name, stops, colors, radius, startX, startY, endX, endY, tileMode);
|
||||||
return linear(
|
return orElse();
|
||||||
name, stops, colors, radius, startX, startY, endX, endY, tileMode);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -1335,9 +1305,6 @@ class _$CustomLinearGradient
|
|||||||
@required Result radial(CustomRadialGradient value),
|
@required Result radial(CustomRadialGradient value),
|
||||||
@required Result linear(CustomLinearGradient value),
|
@required Result linear(CustomLinearGradient value),
|
||||||
}) {
|
}) {
|
||||||
assert($default != null);
|
|
||||||
assert(radial != null);
|
|
||||||
assert(linear != null);
|
|
||||||
return linear(this);
|
return linear(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1349,11 +1316,8 @@ class _$CustomLinearGradient
|
|||||||
Result linear(CustomLinearGradient value),
|
Result linear(CustomLinearGradient value),
|
||||||
@required Result orElse(),
|
@required Result orElse(),
|
||||||
}) {
|
}) {
|
||||||
assert(orElse != null);
|
return linear(this);
|
||||||
if (linear != null) {
|
return orElse();
|
||||||
return linear(this);
|
|
||||||
}
|
|
||||||
return orElse();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -196,10 +196,7 @@ class _$ProjectScreen with DiagnosticableTreeMixin implements ProjectScreen {
|
|||||||
this.dx,
|
this.dx,
|
||||||
this.dy,
|
this.dy,
|
||||||
this.width,
|
this.width,
|
||||||
this.height})
|
this.height});
|
||||||
: assert(className != null),
|
|
||||||
assert(isStateful != null),
|
|
||||||
assert(route != null);
|
|
||||||
|
|
||||||
factory _$ProjectScreen.fromJson(Map<String, dynamic> json) =>
|
factory _$ProjectScreen.fromJson(Map<String, dynamic> json) =>
|
||||||
_$_$ProjectScreenFromJson(json);
|
_$_$ProjectScreenFromJson(json);
|
||||||
|
|||||||
@@ -106,12 +106,8 @@ class ProjectFile extends ProjectFileBase {
|
|||||||
|
|
||||||
Future<FileData> getFileData() async {
|
Future<FileData> getFileData() async {
|
||||||
List<int> _data;
|
List<int> _data;
|
||||||
if (content.value != null) {
|
_data = content.value;
|
||||||
_data = content.value;
|
return FileData(
|
||||||
} else if (readAsBytes != null) {
|
|
||||||
_data = await readAsBytes;
|
|
||||||
}
|
|
||||||
return FileData(
|
|
||||||
_data,
|
_data,
|
||||||
_data.length,
|
_data.length,
|
||||||
filename,
|
filename,
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class LayoutExample extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
child: Icon(Icons.add),
|
child: Icon(Icons.add),
|
||||||
backgroundColor: Theme.of(context).accentColor,
|
backgroundColor: Theme.of(context).colorScheme.secondary,
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class _ListExampleState extends State<ListExample> {
|
|||||||
title: Text("App Bar"),
|
title: Text("App Bar"),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
itemCount: _items?.length ?? 0,
|
itemCount: _items.length ?? 0,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
final i = _items[index];
|
final i = _items[index];
|
||||||
return ListTile(
|
return ListTile(
|
||||||
|
|||||||
@@ -22,16 +22,14 @@ void _setTargetPlatformForDesktop() {
|
|||||||
} else if (Platform.isLinux || Platform.isWindows) {
|
} else if (Platform.isLinux || Platform.isWindows) {
|
||||||
targetPlatform = TargetPlatform.android;
|
targetPlatform = TargetPlatform.android;
|
||||||
}
|
}
|
||||||
if (targetPlatform != null) {
|
debugDefaultTargetPlatformOverride = targetPlatform;
|
||||||
debugDefaultTargetPlatformOverride = targetPlatform;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData.light().copyWith(accentColor: Colors.red),
|
theme: ThemeData.light().copyWith(colorScheme: ColorScheme.fromSwatch().copyWith(secondary: Colors.red)),
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
home: HomePage(),
|
home: HomePage(),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -51,16 +51,15 @@ class DetailsView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (_details?.title != null)
|
Expanded(
|
||||||
Expanded(
|
child: Center(child: _details.title),
|
||||||
child: Center(child: _details.title),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
actions: _details?.actions,
|
actions: _details.actions,
|
||||||
),
|
),
|
||||||
body: _details.child,
|
body: _details.child,
|
||||||
bottomNavigationBar: _details?.bottomAppBar,
|
bottomNavigationBar: _details.bottomAppBar,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,9 +85,9 @@ class _ThreeColumnNavigationState extends State<ThreeColumnNavigation> {
|
|||||||
Container(
|
Container(
|
||||||
width: 300,
|
width: 300,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
backgroundColor: widget?.backgroundColor,
|
backgroundColor: widget.backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: widget?.title,
|
title: widget.title,
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: Icon(widget.expandedIconData),
|
icon: Icon(widget.expandedIconData),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@@ -111,7 +111,7 @@ class _ThreeColumnNavigationState extends State<ThreeColumnNavigation> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
bottomNavigationBar: widget?.bottomAppBar,
|
bottomNavigationBar: widget.bottomAppBar,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
@@ -164,7 +164,7 @@ class _ThreeColumnNavigationState extends State<ThreeColumnNavigation> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
bottomNavigationBar:
|
bottomNavigationBar:
|
||||||
widget.sections[_sectionIndex]?.bottomAppBar,
|
widget.sections[_sectionIndex].bottomAppBar,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -221,7 +221,7 @@ class _ThreeColumnNavigationState extends State<ThreeColumnNavigation> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: widget.sections[_sectionIndex]?.label,
|
title: widget.sections[_sectionIndex].label,
|
||||||
),
|
),
|
||||||
body: SectionList(
|
body: SectionList(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
@@ -250,7 +250,7 @@ class _ThreeColumnNavigationState extends State<ThreeColumnNavigation> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
bottomNavigationBar: widget.sections[_sectionIndex]?.bottomAppBar,
|
bottomNavigationBar: widget.sections[_sectionIndex].bottomAppBar,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -46,16 +46,16 @@ class ResponsiveScaffold extends StatelessWidget {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Row(
|
Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
if (drawer != null) ...[
|
...[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: _drawerWidth,
|
width: _drawerWidth,
|
||||||
child: Drawer(
|
child: Drawer(
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: drawer,
|
child: drawer,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
|
],
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
key: scaffoldKey,
|
key: scaffoldKey,
|
||||||
@@ -64,9 +64,9 @@ class ResponsiveScaffold extends StatelessWidget {
|
|||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
title: title,
|
title: title,
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
if (trailing != null) ...[
|
...[
|
||||||
trailing,
|
trailing,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Row(
|
body: Row(
|
||||||
@@ -74,30 +74,30 @@ class ResponsiveScaffold extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: body ?? Container(),
|
child: body ?? Container(),
|
||||||
),
|
),
|
||||||
if (endDrawer != null) ...[
|
...[
|
||||||
Container(
|
Container(
|
||||||
width: _drawerWidth,
|
width: _drawerWidth,
|
||||||
child: Drawer(
|
child: Drawer(
|
||||||
elevation: 3.0,
|
elevation: 3.0,
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: endDrawer,
|
child: endDrawer,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (floatingActionButton != null) ...[
|
...[
|
||||||
Positioned(
|
Positioned(
|
||||||
top: 100.0,
|
top: 100.0,
|
||||||
left: _drawerWidth - 30,
|
left: _drawerWidth - 30,
|
||||||
child: floatingActionButton,
|
child: floatingActionButton,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -105,9 +105,7 @@ class ResponsiveScaffold extends StatelessWidget {
|
|||||||
if (constraints.maxWidth >= kTabletBreakpoint) {
|
if (constraints.maxWidth >= kTabletBreakpoint) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
key: scaffoldKey,
|
key: scaffoldKey,
|
||||||
drawer: drawer == null
|
drawer: Drawer(
|
||||||
? null
|
|
||||||
: Drawer(
|
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: drawer,
|
child: drawer,
|
||||||
),
|
),
|
||||||
@@ -118,9 +116,9 @@ class ResponsiveScaffold extends StatelessWidget {
|
|||||||
title: title,
|
title: title,
|
||||||
leading: _MenuButton(iconData: menuIcon),
|
leading: _MenuButton(iconData: menuIcon),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
if (trailing != null) ...[
|
...[
|
||||||
trailing,
|
trailing,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
@@ -133,26 +131,26 @@ class ResponsiveScaffold extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: body ?? Container(),
|
child: body ?? Container(),
|
||||||
),
|
),
|
||||||
if (endDrawer != null) ...[
|
...[
|
||||||
Container(
|
Container(
|
||||||
width: _drawerWidth,
|
width: _drawerWidth,
|
||||||
child: Drawer(
|
child: Drawer(
|
||||||
elevation: 3.0,
|
elevation: 3.0,
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: endDrawer,
|
child: endDrawer,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (floatingActionButton != null) ...[
|
...[
|
||||||
Positioned(
|
Positioned(
|
||||||
top: 10.0,
|
top: 10.0,
|
||||||
left: 10.0,
|
left: 10.0,
|
||||||
child: floatingActionButton,
|
child: floatingActionButton,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -160,16 +158,12 @@ class ResponsiveScaffold extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
key: scaffoldKey,
|
key: scaffoldKey,
|
||||||
drawer: drawer == null
|
drawer: Drawer(
|
||||||
? null
|
|
||||||
: Drawer(
|
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: drawer,
|
child: drawer,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
endDrawer: endDrawer == null
|
endDrawer: Drawer(
|
||||||
? null
|
|
||||||
: Drawer(
|
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: endDrawer,
|
child: endDrawer,
|
||||||
),
|
),
|
||||||
@@ -180,12 +174,12 @@ class ResponsiveScaffold extends StatelessWidget {
|
|||||||
leading: _MenuButton(iconData: menuIcon),
|
leading: _MenuButton(iconData: menuIcon),
|
||||||
title: title,
|
title: title,
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
if (trailing != null) ...[
|
...[
|
||||||
trailing,
|
trailing,
|
||||||
],
|
],
|
||||||
if (endDrawer != null) ...[
|
...[
|
||||||
_OptionsButton(iconData: endIcon),
|
_OptionsButton(iconData: endIcon),
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: body,
|
body: body,
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ class ResponsiveListScaffold extends StatelessWidget {
|
|||||||
persistentFooterButtons: persistentFooterButtons,
|
persistentFooterButtons: persistentFooterButtons,
|
||||||
floatingActionButtonAnimator: floatingActionButtonAnimator,
|
floatingActionButtonAnimator: floatingActionButtonAnimator,
|
||||||
resizeToAvoidBottomInset: resizeToAvoidBottomInset,
|
resizeToAvoidBottomInset: resizeToAvoidBottomInset,
|
||||||
resizeToAvoidBottomPadding: resizeToAvoidBottomPadding,
|
resizeToAvoidBottomInset: resizeToAvoidBottomPadding,
|
||||||
primary: primary,
|
primary: primary,
|
||||||
// extendBody: extendBody,
|
// extendBody: extendBody,
|
||||||
backgroundColor: backgroundColor,
|
backgroundColor: backgroundColor,
|
||||||
|
|||||||
@@ -69,11 +69,10 @@ class MobileView extends StatelessWidget {
|
|||||||
..addAll(slivers ?? [])
|
..addAll(slivers ?? [])
|
||||||
..add(Builder(
|
..add(Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
if (childDelagate?.estimatedChildCount == null && nullItems != null)
|
if (childDelagate.estimatedChildCount == null)
|
||||||
return SliverFillRemaining(child: nullItems);
|
return SliverFillRemaining(child: nullItems);
|
||||||
if (childDelagate?.estimatedChildCount != null &&
|
if (childDelagate.estimatedChildCount != null &&
|
||||||
childDelagate.estimatedChildCount == 0 &&
|
childDelagate.estimatedChildCount == 0)
|
||||||
emptyItems != null)
|
|
||||||
return SliverFillRemaining(child: emptyItems);
|
return SliverFillRemaining(child: emptyItems);
|
||||||
return SliverList(
|
return SliverList(
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
@@ -101,7 +100,7 @@ class MobileView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
childCount: childDelagate?.estimatedChildCount ?? 0,
|
childCount: childDelagate.estimatedChildCount ?? 0,
|
||||||
addAutomaticKeepAlives: false,
|
addAutomaticKeepAlives: false,
|
||||||
addRepaintBoundaries: false,
|
addRepaintBoundaries: false,
|
||||||
addSemanticIndexes: false,
|
addSemanticIndexes: false,
|
||||||
|
|||||||
@@ -171,40 +171,38 @@ class _TabletViewState extends State<TabletView> {
|
|||||||
body: Flex(
|
body: Flex(
|
||||||
direction: Axis.horizontal,
|
direction: Axis.horizontal,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
widget?.sideMenu ?? Container(),
|
widget.sideMenu ?? Container(),
|
||||||
Flexible(
|
Flexible(
|
||||||
flex: widget.flexListView,
|
flex: widget.flexListView,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
key: widget?.scaffoldkey,
|
key: widget.scaffoldkey,
|
||||||
floatingActionButton: widget?.floatingActionButton,
|
floatingActionButton: widget.floatingActionButton,
|
||||||
floatingActionButtonLocation:
|
floatingActionButtonLocation:
|
||||||
widget?.floatingActionButtonLocation,
|
widget.floatingActionButtonLocation,
|
||||||
bottomNavigationBar: widget?.bottomNavigationBar,
|
bottomNavigationBar: widget.bottomNavigationBar,
|
||||||
bottomSheet: widget?.bottomSheet,
|
bottomSheet: widget.bottomSheet,
|
||||||
persistentFooterButtons: widget?.persistentFooterButtons,
|
persistentFooterButtons: widget.persistentFooterButtons,
|
||||||
floatingActionButtonAnimator:
|
floatingActionButtonAnimator:
|
||||||
widget?.floatingActionButtonAnimator,
|
widget.floatingActionButtonAnimator,
|
||||||
resizeToAvoidBottomInset: widget?.resizeToAvoidBottomInset,
|
resizeToAvoidBottomInset: widget.resizeToAvoidBottomInset,
|
||||||
resizeToAvoidBottomPadding: widget?.resizeToAvoidBottomPadding,
|
resizeToAvoidBottomInset: widget.resizeToAvoidBottomPadding,
|
||||||
primary: widget?.primary,
|
primary: widget.primary,
|
||||||
// extendBody: extendBody,
|
// extendBody: extendBody,
|
||||||
backgroundColor: widget?.backgroundColor,
|
backgroundColor: widget.backgroundColor,
|
||||||
drawer: widget?.drawer,
|
drawer: widget.drawer,
|
||||||
endDrawer: widget?.endDrawer,
|
endDrawer: widget.endDrawer,
|
||||||
appBar: widget?.appBar,
|
appBar: widget.appBar,
|
||||||
body: CustomScrollView(
|
body: CustomScrollView(
|
||||||
slivers: <Widget>[]
|
slivers: <Widget>[]
|
||||||
..addAll(widget.slivers ?? [])
|
..addAll(widget.slivers ?? [])
|
||||||
..add(Builder(
|
..add(Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
SliverChildDelegate _childDelagate =
|
SliverChildDelegate _childDelagate =
|
||||||
widget?.childDelagate;
|
widget.childDelagate;
|
||||||
if (_childDelagate?.estimatedChildCount == null &&
|
if (_childDelagate.estimatedChildCount == null)
|
||||||
widget?.nullItems != null)
|
|
||||||
return SliverFillRemaining(child: widget.nullItems);
|
return SliverFillRemaining(child: widget.nullItems);
|
||||||
if (_childDelagate?.estimatedChildCount != null &&
|
if (_childDelagate.estimatedChildCount != null &&
|
||||||
_childDelagate.estimatedChildCount == 0 &&
|
_childDelagate.estimatedChildCount == 0)
|
||||||
widget?.emptyItems != null)
|
|
||||||
return SliverFillRemaining(child: widget.emptyItems);
|
return SliverFillRemaining(child: widget.emptyItems);
|
||||||
return SliverList(
|
return SliverList(
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
@@ -224,7 +222,7 @@ class _TabletViewState extends State<TabletView> {
|
|||||||
? Theme.of(context)
|
? Theme.of(context)
|
||||||
.chipTheme
|
.chipTheme
|
||||||
.disabledColor
|
.disabledColor
|
||||||
: widget?.backgroundColor,
|
: widget.backgroundColor,
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets.symmetric(vertical: 8.0),
|
const EdgeInsets.symmetric(vertical: 8.0),
|
||||||
child: _childDelagate.build(context, index),
|
child: _childDelagate.build(context, index),
|
||||||
@@ -233,7 +231,7 @@ class _TabletViewState extends State<TabletView> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
childCount: _childDelagate?.estimatedChildCount ?? 0,
|
childCount: _childDelagate.estimatedChildCount ?? 0,
|
||||||
addAutomaticKeepAlives: false,
|
addAutomaticKeepAlives: false,
|
||||||
addRepaintBoundaries: false,
|
addRepaintBoundaries: false,
|
||||||
addSemanticIndexes: false,
|
addSemanticIndexes: false,
|
||||||
@@ -246,12 +244,11 @@ class _TabletViewState extends State<TabletView> {
|
|||||||
Flexible(
|
Flexible(
|
||||||
flex: widget.flexDetailView,
|
flex: widget.flexDetailView,
|
||||||
child: new _DetailView(
|
child: new _DetailView(
|
||||||
detailScaffoldKey: widget?.detailScaffoldKey,
|
detailScaffoldKey: widget.detailScaffoldKey,
|
||||||
details: _index == null ||
|
details: _index > widget.childDelagate.estimatedChildCount - 1
|
||||||
_index > widget.childDelagate.estimatedChildCount - 1
|
|
||||||
? null
|
? null
|
||||||
: widget.detailBuilder(context, _index, true),
|
: widget.detailBuilder(context, _index, true),
|
||||||
itemNotSelected: widget?.itemNotSelected,
|
itemNotSelected: widget.itemNotSelected,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -18,21 +18,21 @@ class MyApp extends StatelessWidget {
|
|||||||
screen: Screen1(),
|
screen: Screen1(),
|
||||||
tab: BottomNavigationBarItem(
|
tab: BottomNavigationBarItem(
|
||||||
icon: Icon(Icons.home),
|
icon: Icon(Icons.home),
|
||||||
title: Text('Home'),
|
label: Text('Home'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ScreenTab(
|
ScreenTab(
|
||||||
screen: Screen2(),
|
screen: Screen2(),
|
||||||
tab: BottomNavigationBarItem(
|
tab: BottomNavigationBarItem(
|
||||||
icon: Icon(Icons.event),
|
icon: Icon(Icons.event),
|
||||||
title: Text('Calendar'),
|
label: Text('Calendar'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ScreenTab(
|
ScreenTab(
|
||||||
screen: Screen3(),
|
screen: Screen3(),
|
||||||
tab: BottomNavigationBarItem(
|
tab: BottomNavigationBarItem(
|
||||||
icon: Icon(Icons.search),
|
icon: Icon(Icons.search),
|
||||||
title: Text('Search'),
|
label: Text('Search'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class _ScaffoldTabBarState extends State<ScaffoldTabBar> {
|
|||||||
_screens = widget.children;
|
_screens = widget.children;
|
||||||
_currentIndex = 0;
|
_currentIndex = 0;
|
||||||
for (var screen in _screens) {
|
for (var screen in _screens) {
|
||||||
_keys.add(GlobalKey<NavigatorState>(debugLabel: screen?.debugLabel));
|
_keys.add(GlobalKey<NavigatorState>(debugLabel: screen.debugLabel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,23 +98,23 @@ class _ScaffoldTabBarState extends State<ScaffoldTabBar> {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: widget?.backgroundColor,
|
backgroundColor: widget.backgroundColor,
|
||||||
key: widget?.scaffoldKey,
|
key: widget.scaffoldKey,
|
||||||
drawer: widget?.drawer,
|
drawer: widget.drawer,
|
||||||
endDrawer: widget?.endDrawer,
|
endDrawer: widget.endDrawer,
|
||||||
persistentFooterButtons: widget?.persistentFooterButtons,
|
persistentFooterButtons: widget.persistentFooterButtons,
|
||||||
floatingActionButton: widget?.floatingActionButton,
|
floatingActionButton: widget.floatingActionButton,
|
||||||
floatingActionButtonAnimator: widget?.floatingActionButtonAnimator,
|
floatingActionButtonAnimator: widget.floatingActionButtonAnimator,
|
||||||
floatingActionButtonLocation: widget?.floatingActionButtonLocation,
|
floatingActionButtonLocation: widget.floatingActionButtonLocation,
|
||||||
body: IndexedStack(
|
body: IndexedStack(
|
||||||
index: _currentIndex,
|
index: _currentIndex,
|
||||||
children: _children,
|
children: _children,
|
||||||
),
|
),
|
||||||
bottomNavigationBar: BottomNavigationBar(
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
type: widget?.bottomNavigationBarType,
|
type: widget.bottomNavigationBarType,
|
||||||
currentIndex: _currentIndex,
|
currentIndex: _currentIndex,
|
||||||
onTap: (val) => _onTap(val, context),
|
onTap: (val) => _onTap(val, context),
|
||||||
backgroundColor: widget?.bottomNavigationBarBackgroundColor ??
|
backgroundColor: widget.bottomNavigationBarBackgroundColor ??
|
||||||
Theme.of(context).scaffoldBackgroundColor,
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
items: _screens.map((s) => s.tab).toList(),
|
items: _screens.map((s) => s.tab).toList(),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'${snapshot.data}',
|
'${snapshot.data}',
|
||||||
style: Theme.of(context).textTheme.headline4,
|
style: Theme.of(context).textTheme.headlineMedium,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user