[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.
This sample is currently being built. Not all platforms and functionality are in place.
## Goals for this sample
* Show how to read and write files on Desktop
* Show how to create, parse and use yaml files
* Show how to implement basic navigation in Desktop apps
* Show how to implement right-click popup menus
## Questions/issues

@ -7,11 +7,21 @@ import 'package:hive_flutter/hive_flutter.dart';
import 'package:linting_tool/app.dart';
import 'package:linting_tool/model/profile.dart';
import 'package:linting_tool/model/rule.dart';
import 'package:window_size/window_size.dart';
Future<void> main() async {
/// Initiliaze Hive DB.
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(RulesProfileAdapter());
/// Open a [LazyBox] to retrieve data from it
await Hive.openLazyBox<RulesProfile>('rules_profile');
setWindowMinSize(const Size(600, 600));
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/rule.dart';
/// Used to control editing of the saved profiles on the RulesPage.
class EditingController extends ChangeNotifier {
bool _isEditing;

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

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

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

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

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

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

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

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

@ -195,7 +195,6 @@ class _NavigationRailHeader extends StatelessWidget {
children: [
const SizedBox(width: 6),
InkWell(
key: const ValueKey('ReplyLogo'),
borderRadius: const BorderRadius.all(Radius.circular(16)),
onTap: () {
extended.value = !extended.value!;
@ -323,7 +322,15 @@ class _NavigationRailTrailingSection extends StatelessWidget {
void _onTapped(BuildContext context, String key) {
switch (key) {
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;
default:
break;

@ -177,6 +177,8 @@ class _ProfileTypeDialog extends StatelessWidget {
@override
Widget build(BuildContext context) {
var profilesStore = context.watch<ProfilesStore>();
return AlertDialog(
actionsPadding: const EdgeInsets.only(
left: 16.0,
@ -185,17 +187,18 @@ class _ProfileTypeDialog extends StatelessWidget {
),
title: const Text('Select Profile Type'),
actions: [
ElevatedButton(
onPressed: () {
Navigator.pop(context, ProfileType.existingProfile);
},
child: const Text('Existing Profile'),
),
if (profilesStore.savedProfiles.isNotEmpty)
ElevatedButton(
onPressed: () {
Navigator.pop(context, ProfileType.existingProfile);
},
child: const Text('Existing'),
),
TextButton(
onPressed: () {
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 <url_launcher_linux/url_launcher_plugin.h>
#include <window_size/window_size_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
@ -14,4 +15,7 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
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
file_selector_linux
url_launcher_linux
window_size
)
set(PLUGIN_BUNDLED_LIBRARIES)

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

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

@ -692,14 +692,14 @@ packages:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.0.4"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.0.2"
vector_math:
dependency: transitive
description:
@ -728,6 +728,15 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:

@ -3,6 +3,8 @@ description: A new Flutter project.
version: 1.0.0+1
publish_to: 'none'
environment:
sdk: ">=2.12.0 <3.0.0"
@ -28,6 +30,11 @@ dependencies:
provider: ^5.0.0
yaml: ^3.1.0
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:
flutter_test:

@ -5,11 +5,14 @@
#include "generated_plugin_registrant.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) {
FileSelectorPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FileSelectorPlugin"));
UrlLauncherPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
WindowSizePluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("WindowSizePlugin"));
}

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

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

Loading…
Cancel
Save