[linting_tool] Prepare for release (#880)

pull/881/head
Abdullah Deshmukh 3 years ago committed by GitHub
parent 0aad30fc5b
commit 410e43fbc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,13 +2,12 @@
A desktop tool that helps you manage linter rules for your Flutter project. A desktop tool that helps you manage linter rules for your Flutter project.
This sample is currently being built. Not all platforms and functionality are in place.
## Goals for this sample ## Goals for this sample
* Show how to read and write files on Desktop * Show how to read and write files on Desktop
* Show how to create, parse and use yaml files * Show how to create, parse and use yaml files
* Show how to implement basic navigation in Desktop apps * Show how to implement basic navigation in Desktop apps
* Show how to implement right-click popup menus
## Questions/issues ## Questions/issues

@ -7,11 +7,21 @@ import 'package:hive_flutter/hive_flutter.dart';
import 'package:linting_tool/app.dart'; import 'package:linting_tool/app.dart';
import 'package:linting_tool/model/profile.dart'; import 'package:linting_tool/model/profile.dart';
import 'package:linting_tool/model/rule.dart'; import 'package:linting_tool/model/rule.dart';
import 'package:window_size/window_size.dart';
Future<void> main() async { Future<void> main() async {
/// Initiliaze Hive DB.
await Hive.initFlutter(); await Hive.initFlutter();
/// Register adapters for [Rule] and [RulesProfile]
/// so that their objects can be directly saved to the DB.
Hive.registerAdapter(RuleAdapter()); Hive.registerAdapter(RuleAdapter());
Hive.registerAdapter(RulesProfileAdapter()); Hive.registerAdapter(RulesProfileAdapter());
/// Open a [LazyBox] to retrieve data from it
await Hive.openLazyBox<RulesProfile>('rules_profile'); await Hive.openLazyBox<RulesProfile>('rules_profile');
setWindowMinSize(const Size(600, 600));
runApp(const LintingTool()); runApp(const LintingTool());
} }

@ -7,6 +7,7 @@ import 'package:linting_tool/model/profile.dart';
import 'package:linting_tool/model/profiles_store.dart'; import 'package:linting_tool/model/profiles_store.dart';
import 'package:linting_tool/model/rule.dart'; import 'package:linting_tool/model/rule.dart';
/// Used to control editing of the saved profiles on the RulesPage.
class EditingController extends ChangeNotifier { class EditingController extends ChangeNotifier {
bool _isEditing; bool _isEditing;

@ -111,6 +111,7 @@ class ProfilesStore extends ChangeNotifier {
try { try {
var templateFileData = await repository.getTemplateFile(); var templateFileData = await repository.getTemplateFile();
/// Fetch formatted data to create new YamlFile.
String newYamlFile = String newYamlFile =
_prepareYamlFile(profile, templateFileData, rulesStyle); _prepareYamlFile(profile, templateFileData, rulesStyle);

@ -11,6 +11,7 @@ import 'package:linting_tool/model/rule.dart';
import 'package:linting_tool/repository/repository.dart'; import 'package:linting_tool/repository/repository.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
/// Manages fetching rules from the web.
class RuleStore extends ChangeNotifier { class RuleStore extends ChangeNotifier {
late final Repository repository; late final Repository repository;

@ -28,19 +28,19 @@ class DefaultLintsPage extends StatelessWidget {
? 60.0 ? 60.0
: isDesktop : isDesktop
? 120.0 ? 120.0
: 4.0; : 16.0;
final endPadding = isTablet final endPadding = isTablet
? 60.0 ? 60.0
: isDesktop : isDesktop
? 120.0 ? 120.0
: 4.0; : 16.0;
return ListView.separated( return ListView.separated(
padding: EdgeInsetsDirectional.only( padding: EdgeInsetsDirectional.only(
start: startPadding, start: startPadding,
end: endPadding, end: endPadding,
top: isDesktop ? 28 : 0, top: isDesktop ? 28 : 16,
bottom: isDesktop ? kToolbarHeight : 0, bottom: isDesktop ? kToolbarHeight : 16,
), ),
cacheExtent: 5, cacheExtent: 5,
itemCount: defaultSets.length, itemCount: defaultSets.length,

@ -24,12 +24,12 @@ class DefaultRulesPage extends StatelessWidget {
? 60.0 ? 60.0
: isDesktop : isDesktop
? 120.0 ? 120.0
: 4.0; : 16.0;
final endPadding = isTablet final endPadding = isTablet
? 60.0 ? 60.0
: isDesktop : isDesktop
? 120.0 ? 120.0
: 4.0; : 16.0;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text( title: Text(
@ -57,8 +57,8 @@ class DefaultRulesPage extends StatelessWidget {
padding: EdgeInsetsDirectional.only( padding: EdgeInsetsDirectional.only(
start: startPadding, start: startPadding,
end: endPadding, end: endPadding,
top: isDesktop ? 28 : 0, top: isDesktop ? 28 : 16,
bottom: isDesktop ? kToolbarHeight : 0, bottom: isDesktop ? kToolbarHeight : 16,
), ),
itemCount: profile.rules.length, itemCount: profile.rules.length,
cacheExtent: 5, cacheExtent: 5,

@ -27,19 +27,19 @@ class HomePage extends StatelessWidget {
? 60.0 ? 60.0
: isDesktop : isDesktop
? 120.0 ? 120.0
: 4.0; : 16.0;
final endPadding = isTablet final endPadding = isTablet
? 60.0 ? 60.0
: isDesktop : isDesktop
? 120.0 ? 120.0
: 4.0; : 16.0;
return ListView.separated( return ListView.separated(
padding: EdgeInsetsDirectional.only( padding: EdgeInsetsDirectional.only(
start: startPadding, start: startPadding,
end: endPadding, end: endPadding,
top: isDesktop ? 28 : 0, top: isDesktop ? 28 : 16,
bottom: isDesktop ? kToolbarHeight : 0, bottom: isDesktop ? kToolbarHeight : 16,
), ),
itemCount: rulesStore.rules.length, itemCount: rulesStore.rules.length,
cacheExtent: 5, cacheExtent: 5,

@ -27,7 +27,7 @@ class RulesPage extends StatelessWidget {
? 60.0 ? 60.0
: isDesktop : isDesktop
? 120.0 ? 120.0
: 4.0; : 16.0;
final endPadding = isTablet final endPadding = isTablet
? 60.0 ? 60.0
: isDesktop : isDesktop
@ -59,6 +59,9 @@ class RulesPage extends StatelessWidget {
backgroundColor: Colors.white, backgroundColor: Colors.white,
brightness: Brightness.light, brightness: Brightness.light,
), ),
/// ContextMenuOverlay is required to show
/// right-click context menus using ContextMenuRegion.
body: ContextMenuOverlay( body: ContextMenuOverlay(
child: Consumer<ProfilesStore>( child: Consumer<ProfilesStore>(
builder: (context, profilesStore, child) { builder: (context, profilesStore, child) {
@ -75,17 +78,18 @@ class RulesPage extends StatelessWidget {
padding: EdgeInsetsDirectional.only( padding: EdgeInsetsDirectional.only(
start: startPadding, start: startPadding,
end: endPadding, end: endPadding,
top: isDesktop ? 28 : 0, top: isDesktop ? 28 : 16,
bottom: isDesktop ? kToolbarHeight : 0, bottom: isDesktop ? kToolbarHeight : 16,
), ),
itemCount: profile.rules.length, itemCount: profile.rules.length,
cacheExtent: 5, cacheExtent: 5,
itemBuilder: (context, index) { itemBuilder: (context, index) {
/// Show righ-click context menu to delete rule.
return ContextMenuRegion( return ContextMenuRegion(
contextMenu: GenericContextMenu( contextMenu: GenericContextMenu(
buttonConfigs: [ buttonConfigs: [
ContextMenuButtonConfig( ContextMenuButtonConfig(
'Remove from profile', 'Remove rule from profile',
onPressed: () { onPressed: () {
context context
.read<ProfilesStore>() .read<ProfilesStore>()

@ -30,19 +30,19 @@ class SavedLintsPage extends StatelessWidget {
? 60.0 ? 60.0
: isDesktop : isDesktop
? 120.0 ? 120.0
: 4.0; : 16.0;
final endPadding = isTablet final endPadding = isTablet
? 60.0 ? 60.0
: isDesktop : isDesktop
? 120.0 ? 120.0
: 4.0; : 16.0;
return ListView.separated( return ListView.separated(
padding: EdgeInsetsDirectional.only( padding: EdgeInsetsDirectional.only(
start: startPadding, start: startPadding,
end: endPadding, end: endPadding,
top: isDesktop ? 28 : 0, top: isDesktop ? 28 : 16,
bottom: isDesktop ? kToolbarHeight : 0, bottom: isDesktop ? kToolbarHeight : 16,
), ),
itemCount: profilesStore.savedProfiles.length, itemCount: profilesStore.savedProfiles.length,
cacheExtent: 5, cacheExtent: 5,
@ -74,8 +74,9 @@ class SavedLintsPage extends StatelessWidget {
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => ChangeNotifierProvider( builder: (context) => ChangeNotifierProvider(
create: (context) => create: (context) => EditingController(
EditingController(isEditing: true), isEditing: true,
),
child: RulesPage(selectedProfileIndex: index), child: RulesPage(selectedProfileIndex: index),
), ),
), ),

@ -18,12 +18,16 @@ class AppTheme {
), ),
navigationRailTheme: NavigationRailThemeData( navigationRailTheme: NavigationRailThemeData(
backgroundColor: AppColors.blue700, backgroundColor: AppColors.blue700,
selectedIconTheme: const IconThemeData(color: AppColors.orange500), selectedIconTheme: const IconThemeData(
color: AppColors.orange500,
),
selectedLabelTextStyle: selectedLabelTextStyle:
GoogleFonts.workSansTextTheme().headline5!.copyWith( GoogleFonts.workSansTextTheme().headline5!.copyWith(
color: AppColors.orange500, color: AppColors.orange500,
), ),
unselectedIconTheme: const IconThemeData(color: AppColors.blue200), unselectedIconTheme: const IconThemeData(
color: AppColors.blue200,
),
unselectedLabelTextStyle: unselectedLabelTextStyle:
GoogleFonts.workSansTextTheme().headline5!.copyWith( GoogleFonts.workSansTextTheme().headline5!.copyWith(
color: AppColors.blue200, color: AppColors.blue200,
@ -36,7 +40,9 @@ class AppTheme {
AppColors.lightChipBackground, AppColors.lightChipBackground,
Brightness.light, Brightness.light,
), ),
colorScheme: ColorScheme.fromSwatch(primarySwatch: Colors.blueGrey), colorScheme: ColorScheme.fromSwatch(
primarySwatch: Colors.blueGrey,
),
textTheme: _buildReplyLightTextTheme(base.textTheme), textTheme: _buildReplyLightTextTheme(base.textTheme),
scaffoldBackgroundColor: AppColors.blue50, scaffoldBackgroundColor: AppColors.blue50,
); );
@ -52,12 +58,16 @@ class AppTheme {
), ),
navigationRailTheme: NavigationRailThemeData( navigationRailTheme: NavigationRailThemeData(
backgroundColor: AppColors.darkBottomAppBarBackground, backgroundColor: AppColors.darkBottomAppBarBackground,
selectedIconTheme: const IconThemeData(color: AppColors.orange300), selectedIconTheme: const IconThemeData(
color: AppColors.orange300,
),
selectedLabelTextStyle: selectedLabelTextStyle:
GoogleFonts.workSansTextTheme().headline5!.copyWith( GoogleFonts.workSansTextTheme().headline5!.copyWith(
color: AppColors.orange300, color: AppColors.orange300,
), ),
unselectedIconTheme: const IconThemeData(color: AppColors.greyLabel), unselectedIconTheme: const IconThemeData(
color: AppColors.greyLabel,
),
unselectedLabelTextStyle: unselectedLabelTextStyle:
GoogleFonts.workSansTextTheme().headline5!.copyWith( GoogleFonts.workSansTextTheme().headline5!.copyWith(
color: AppColors.greyLabel, color: AppColors.greyLabel,

@ -195,7 +195,6 @@ class _NavigationRailHeader extends StatelessWidget {
children: [ children: [
const SizedBox(width: 6), const SizedBox(width: 6),
InkWell( InkWell(
key: const ValueKey('ReplyLogo'),
borderRadius: const BorderRadius.all(Radius.circular(16)), borderRadius: const BorderRadius.all(Radius.circular(16)),
onTap: () { onTap: () {
extended.value = !extended.value!; extended.value = !extended.value!;
@ -323,7 +322,15 @@ class _NavigationRailTrailingSection extends StatelessWidget {
void _onTapped(BuildContext context, String key) { void _onTapped(BuildContext context, String key) {
switch (key) { switch (key) {
case 'About': case 'About':
showAboutDialog(context: context); showAboutDialog(
context: context,
applicationIcon: const FlutterLogo(),
children: [
const Text(
'A tool that helps you manage linter rules for your Flutter projects.',
),
],
);
break; break;
default: default:
break; break;

@ -177,6 +177,8 @@ class _ProfileTypeDialog extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var profilesStore = context.watch<ProfilesStore>();
return AlertDialog( return AlertDialog(
actionsPadding: const EdgeInsets.only( actionsPadding: const EdgeInsets.only(
left: 16.0, left: 16.0,
@ -185,17 +187,18 @@ class _ProfileTypeDialog extends StatelessWidget {
), ),
title: const Text('Select Profile Type'), title: const Text('Select Profile Type'),
actions: [ actions: [
if (profilesStore.savedProfiles.isNotEmpty)
ElevatedButton( ElevatedButton(
onPressed: () { onPressed: () {
Navigator.pop(context, ProfileType.existingProfile); Navigator.pop(context, ProfileType.existingProfile);
}, },
child: const Text('Existing Profile'), child: const Text('Existing'),
), ),
TextButton( TextButton(
onPressed: () { onPressed: () {
Navigator.pop(context, ProfileType.newProfile); Navigator.pop(context, ProfileType.newProfile);
}, },
child: const Text('Create new profile'), child: const Text('New'),
), ),
], ],
); );

@ -6,6 +6,7 @@
#include <file_selector_linux/file_selector_plugin.h> #include <file_selector_linux/file_selector_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h> #include <url_launcher_linux/url_launcher_plugin.h>
#include <window_size/window_size_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) { void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
@ -14,4 +15,7 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
g_autoptr(FlPluginRegistrar) window_size_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "WindowSizePlugin");
window_size_plugin_register_with_registrar(window_size_registrar);
} }

@ -5,6 +5,7 @@
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
file_selector_linux file_selector_linux
url_launcher_linux url_launcher_linux
window_size
) )
set(PLUGIN_BUNDLED_LIBRARIES) set(PLUGIN_BUNDLED_LIBRARIES)

@ -8,9 +8,11 @@ import Foundation
import file_selector_macos import file_selector_macos
import path_provider_macos import path_provider_macos
import url_launcher_macos import url_launcher_macos
import window_size
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
WindowSizePlugin.register(with: registry.registrar(forPlugin: "WindowSizePlugin"))
} }

@ -6,12 +6,15 @@ PODS:
- FlutterMacOS - FlutterMacOS
- url_launcher_macos (0.0.1): - url_launcher_macos (0.0.1):
- FlutterMacOS - FlutterMacOS
- window_size (0.0.2):
- FlutterMacOS
DEPENDENCIES: DEPENDENCIES:
- file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`) - file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`)
- FlutterMacOS (from `Flutter/ephemeral`) - FlutterMacOS (from `Flutter/ephemeral`)
- path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`) - path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`)
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
- window_size (from `Flutter/ephemeral/.symlinks/plugins/window_size/macos`)
EXTERNAL SOURCES: EXTERNAL SOURCES:
file_selector_macos: file_selector_macos:
@ -22,13 +25,16 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos :path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos
url_launcher_macos: url_launcher_macos:
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
window_size:
:path: Flutter/ephemeral/.symlinks/plugins/window_size/macos
SPEC CHECKSUMS: SPEC CHECKSUMS:
file_selector_macos: ff6dc948d4ddd34e8602a1f60b7d0b4cc6051a47 file_selector_macos: ff6dc948d4ddd34e8602a1f60b7d0b4cc6051a47
FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424 FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424
path_provider_macos: a0a3fd666cb7cd0448e936fb4abad4052961002b path_provider_macos: a0a3fd666cb7cd0448e936fb4abad4052961002b
url_launcher_macos: 45af3d61de06997666568a7149c1be98b41c95d4 url_launcher_macos: 45af3d61de06997666568a7149c1be98b41c95d4
window_size: 339dafa0b27a95a62a843042038fa6c3c48de195
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
COCOAPODS: 1.10.1 COCOAPODS: 1.10.2

@ -692,14 +692,14 @@ packages:
name: url_launcher_web name: url_launcher_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.2" version: "2.0.4"
url_launcher_windows: url_launcher_windows:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_windows name: url_launcher_windows
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.1" version: "2.0.2"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
@ -728,6 +728,15 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.2.5" version: "2.2.5"
window_size:
dependency: "direct main"
description:
path: "plugins/window_size"
ref: e48abe7c3e9ebfe0b81622167c5201d4e783bb81
resolved-ref: e48abe7c3e9ebfe0b81622167c5201d4e783bb81
url: "git://github.com/google/flutter-desktop-embedding.git"
source: git
version: "0.1.0"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:

@ -3,6 +3,8 @@ description: A new Flutter project.
version: 1.0.0+1 version: 1.0.0+1
publish_to: 'none'
environment: environment:
sdk: ">=2.12.0 <3.0.0" sdk: ">=2.12.0 <3.0.0"
@ -28,6 +30,11 @@ dependencies:
provider: ^5.0.0 provider: ^5.0.0
yaml: ^3.1.0 yaml: ^3.1.0
context_menus: ^0.1.0+5 context_menus: ^0.1.0+5
window_size:
git:
url: git://github.com/google/flutter-desktop-embedding.git
path: plugins/window_size
ref: e48abe7c3e9ebfe0b81622167c5201d4e783bb81
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

@ -5,11 +5,14 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <file_selector_windows/file_selector_plugin.h> #include <file_selector_windows/file_selector_plugin.h>
#include <url_launcher_windows/url_launcher_plugin.h> #include <url_launcher_windows/url_launcher_windows.h>
#include <window_size/window_size_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) { void RegisterPlugins(flutter::PluginRegistry* registry) {
FileSelectorPluginRegisterWithRegistrar( FileSelectorPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FileSelectorPlugin")); registry->GetRegistrarForPlugin("FileSelectorPlugin"));
UrlLauncherPluginRegisterWithRegistrar( UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherPlugin")); registry->GetRegistrarForPlugin("UrlLauncherWindows"));
WindowSizePluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("WindowSizePlugin"));
} }

@ -5,6 +5,7 @@
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
file_selector_windows file_selector_windows
url_launcher_windows url_launcher_windows
window_size
) )
set(PLUGIN_BUNDLED_LIBRARIES) set(PLUGIN_BUNDLED_LIBRARIES)

@ -7,7 +7,7 @@ packages:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.5.0" version: "2.6.1"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
@ -113,7 +113,7 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.8.1"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -148,7 +148,7 @@ packages:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.19" version: "0.3.0"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:

Loading…
Cancel
Save