mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Some linting_tool updates and cleanup (#1279)
This commit is contained in:
1
experimental/linting_tool/.gitignore
vendored
1
experimental/linting_tool/.gitignore
vendored
@@ -32,7 +32,6 @@
|
||||
/build/
|
||||
|
||||
# Web related
|
||||
lib/generated_plugin_registrant.dart
|
||||
|
||||
# Symbolication related
|
||||
app.*.symbols
|
||||
|
||||
@@ -12,12 +12,10 @@ bool isDisplayLarge(BuildContext context) =>
|
||||
|
||||
/// Returns boolean value whether the window is considered medium size.
|
||||
/// Used to build adaptive and responsive layouts.
|
||||
bool isDisplayMedium(BuildContext context) {
|
||||
return getWindowType(context) == AdaptiveWindowType.medium;
|
||||
}
|
||||
bool isDisplayMedium(BuildContext context) =>
|
||||
getWindowType(context) == AdaptiveWindowType.medium;
|
||||
|
||||
/// Returns boolean value whether the window is considered small size.
|
||||
/// Used to build adaptive and responsive layouts.
|
||||
bool isDisplaySmall(BuildContext context) {
|
||||
return getWindowType(context) <= AdaptiveWindowType.small;
|
||||
}
|
||||
bool isDisplaySmall(BuildContext context) =>
|
||||
getWindowType(context) <= AdaptiveWindowType.small;
|
||||
|
||||
@@ -10,7 +10,7 @@ import 'package:linting_tool/model/rule.dart';
|
||||
import 'package:window_size/window_size.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
/// Initiliaze Hive DB.
|
||||
/// Initialize Hive DB.
|
||||
await Hive.initFlutter();
|
||||
|
||||
/// Register adapters for [Rule] and [RulesProfile]
|
||||
|
||||
@@ -11,7 +11,7 @@ import 'package:linting_tool/model/rule.dart';
|
||||
class EditingController extends ChangeNotifier {
|
||||
bool _isEditing;
|
||||
|
||||
EditingController({bool? isEditing}) : _isEditing = isEditing ?? false;
|
||||
EditingController({bool isEditing = false}) : _isEditing = isEditing;
|
||||
|
||||
bool get isEditing => _isEditing;
|
||||
|
||||
@@ -21,9 +21,9 @@ class EditingController extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
final List<Rule> _selectedRules = [];
|
||||
final Set<Rule> _selectedRules = {};
|
||||
|
||||
List<Rule> get selectedRules => _selectedRules;
|
||||
Set<Rule> get selectedRules => _selectedRules;
|
||||
|
||||
void selectRule(Rule rule) {
|
||||
_selectedRules.add(rule);
|
||||
@@ -37,12 +37,10 @@ class EditingController extends ChangeNotifier {
|
||||
|
||||
Future deleteSelected(
|
||||
RulesProfile profile, ProfilesStore profilesStore) async {
|
||||
var rules = profile.rules;
|
||||
for (var rule in _selectedRules) {
|
||||
rules.remove(rule);
|
||||
}
|
||||
final rules = profile.rules;
|
||||
rules.removeWhere((rule) => _selectedRules.contains(rule));
|
||||
|
||||
RulesProfile newProfile = RulesProfile(name: profile.name, rules: rules);
|
||||
final newProfile = RulesProfile(name: profile.name, rules: rules);
|
||||
|
||||
await profilesStore.updateProfile(profile, newProfile);
|
||||
|
||||
|
||||
@@ -20,11 +20,12 @@ import 'package:yaml/yaml.dart';
|
||||
const _boxName = 'rules_profile';
|
||||
|
||||
class ProfilesStore extends ChangeNotifier {
|
||||
late final Repository repository;
|
||||
ProfilesStore(http.Client httpClient) {
|
||||
repository = Repository(httpClient);
|
||||
final Repository repository;
|
||||
|
||||
ProfilesStore(http.Client httpClient) : repository = Repository(httpClient) {
|
||||
fetchSavedProfiles();
|
||||
}
|
||||
|
||||
bool _isLoading = true;
|
||||
|
||||
bool get isLoading => _isLoading;
|
||||
@@ -41,8 +42,7 @@ class ProfilesStore extends ChangeNotifier {
|
||||
if (!_isLoading) _isLoading = true;
|
||||
notifyListeners();
|
||||
try {
|
||||
var profiles = await HiveService.getBoxes<RulesProfile>(_boxName);
|
||||
_savedProfiles = profiles;
|
||||
_savedProfiles = await HiveService.getBoxes<RulesProfile>(_boxName);
|
||||
} on Exception catch (e) {
|
||||
log(e.toString());
|
||||
}
|
||||
@@ -64,12 +64,16 @@ class ProfilesStore extends ChangeNotifier {
|
||||
// TODO(abd99): Consider refactoring to LinkedHashSet/SplayTreeSet to avoid
|
||||
// duplication automatically.
|
||||
// ref: https://github.com/flutter/samples/pull/870#discussion_r685666792
|
||||
var rules = profile.rules;
|
||||
if (!rules.contains(rule)) {
|
||||
rules.add(rule);
|
||||
final rules = profile.rules;
|
||||
|
||||
// If rule is already in profile, skip updating profile
|
||||
if (rules.contains(rule)) {
|
||||
return;
|
||||
}
|
||||
|
||||
RulesProfile newProfile = RulesProfile(name: profile.name, rules: rules);
|
||||
rules.add(rule);
|
||||
|
||||
final newProfile = RulesProfile(name: profile.name, rules: rules);
|
||||
|
||||
await HiveService.updateBox<RulesProfile>(profile, newProfile, _boxName);
|
||||
|
||||
@@ -88,7 +92,7 @@ class ProfilesStore extends ChangeNotifier {
|
||||
}
|
||||
|
||||
Future<void> removeRuleFromProfile(RulesProfile profile, Rule rule) async {
|
||||
var newProfile =
|
||||
final newProfile =
|
||||
RulesProfile(name: profile.name, rules: profile.rules..remove(rule));
|
||||
await updateProfile(profile, newProfile);
|
||||
}
|
||||
@@ -111,10 +115,10 @@ class ProfilesStore extends ChangeNotifier {
|
||||
var resultSaved = false;
|
||||
|
||||
try {
|
||||
var templateFileData = await repository.getTemplateFile();
|
||||
final templateFileData = await repository.getTemplateFile();
|
||||
|
||||
/// Fetch formatted data to create new YamlFile.
|
||||
String newYamlFile =
|
||||
final newYamlFile =
|
||||
_prepareYamlFile(profile, templateFileData, rulesStyle);
|
||||
|
||||
resultSaved = await _saveFileToDisk(newYamlFile);
|
||||
@@ -136,7 +140,7 @@ class ProfilesStore extends ChangeNotifier {
|
||||
const name = 'analysis_options.yaml';
|
||||
|
||||
/// Get file path using file picker.
|
||||
var savePath = await file_selector.getSavePath(
|
||||
final savePath = await file_selector.getSavePath(
|
||||
suggestedName: name,
|
||||
);
|
||||
|
||||
@@ -149,25 +153,21 @@ class ProfilesStore extends ChangeNotifier {
|
||||
return true;
|
||||
}
|
||||
|
||||
var errorMessage = 'File path not found.';
|
||||
const errorMessage = 'File path not found.';
|
||||
_error = errorMessage;
|
||||
throw Exception(errorMessage);
|
||||
}
|
||||
|
||||
String _prepareYamlFile(
|
||||
RulesProfile profile, YamlMap templateFile, RulesStyle rulesStyle) {
|
||||
var rules = profile.rules.map((e) => e.name).toList();
|
||||
final rules = profile.rules.map((e) => e.name);
|
||||
|
||||
var rulesData =
|
||||
final rulesData =
|
||||
json.decode(json.encode(templateFile)) as Map<String, dynamic>;
|
||||
|
||||
/// Add rules to existing template according to formatting style.
|
||||
if (rulesStyle == RulesStyle.booleanMap) {
|
||||
var rulesMap = Map.fromEntries(
|
||||
rules.map(
|
||||
(e) => MapEntry(e, true),
|
||||
),
|
||||
);
|
||||
final rulesMap = <String, bool>{for (final rule in rules) rule: true};
|
||||
rulesData.update('linter', (dynamic value) => {'rules': rulesMap});
|
||||
} else {
|
||||
rulesData.update('linter', (dynamic value) => {'rules': rules});
|
||||
|
||||
@@ -41,5 +41,5 @@ class Rule extends Equatable {
|
||||
Map<String, dynamic> toJson() => _$RuleToJson(this);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [name];
|
||||
List<Object> get props => [name];
|
||||
}
|
||||
|
||||
@@ -62,19 +62,17 @@ class RuleAdapter extends TypeAdapter<Rule> {
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
Rule _$RuleFromJson(Map<String, dynamic> json) {
|
||||
return Rule(
|
||||
name: json['name'] as String,
|
||||
description: json['description'] as String,
|
||||
group: json['group'] as String,
|
||||
maturity: json['maturity'] as String,
|
||||
incompatible: (json['incompatible'] as List<dynamic>)
|
||||
.map((e) => e as String)
|
||||
.toList(),
|
||||
sets: (json['sets'] as List<dynamic>).map((e) => e as String).toList(),
|
||||
details: json['details'] as String,
|
||||
);
|
||||
}
|
||||
Rule _$RuleFromJson(Map<String, dynamic> json) => Rule(
|
||||
name: json['name'] as String,
|
||||
description: json['description'] as String,
|
||||
group: json['group'] as String,
|
||||
maturity: json['maturity'] as String,
|
||||
incompatible: (json['incompatible'] as List<dynamic>)
|
||||
.map((e) => e as String)
|
||||
.toList(),
|
||||
sets: (json['sets'] as List<dynamic>).map((e) => e as String).toList(),
|
||||
details: json['details'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$RuleToJson(Rule instance) => <String, dynamic>{
|
||||
'name': instance.name,
|
||||
|
||||
@@ -13,12 +13,12 @@ import 'package:linting_tool/repository/repository.dart';
|
||||
|
||||
/// Manages fetching rules from the web.
|
||||
class RuleStore extends ChangeNotifier {
|
||||
late final Repository repository;
|
||||
final Repository repository;
|
||||
|
||||
RuleStore(http.Client httpClient) {
|
||||
repository = Repository(httpClient);
|
||||
RuleStore(http.Client httpClient) : repository = Repository(httpClient) {
|
||||
fetchRules();
|
||||
}
|
||||
|
||||
bool _isLoading = true;
|
||||
|
||||
bool get isLoading => _isLoading;
|
||||
@@ -32,32 +32,31 @@ class RuleStore extends ChangeNotifier {
|
||||
String? get error => _error;
|
||||
|
||||
List<RulesProfile> get defaultProfiles {
|
||||
List<RulesProfile> defaultProfiles = [];
|
||||
if (isLoading || rules.isEmpty) {
|
||||
return const [];
|
||||
}
|
||||
|
||||
var rulesWithDefaultSets =
|
||||
rules.where((rule) => rule.sets.isNotEmpty).toList();
|
||||
final Map<String, RulesProfile> setsToProfiles = {};
|
||||
|
||||
for (final rule in rulesWithDefaultSets) {
|
||||
for (final rule in rules) {
|
||||
for (final setName in rule.sets) {
|
||||
var profileIndex =
|
||||
defaultProfiles.indexWhere((profile) => profile.name == setName);
|
||||
if (profileIndex >= 0) {
|
||||
defaultProfiles[profileIndex].rules.add(rule);
|
||||
final profile = setsToProfiles[setName];
|
||||
if (profile == null) {
|
||||
setsToProfiles[setName] = RulesProfile(name: setName, rules: [rule]);
|
||||
} else {
|
||||
defaultProfiles.add(RulesProfile(name: setName, rules: [rule]));
|
||||
profile.rules.add(rule);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return defaultProfiles;
|
||||
return setsToProfiles.values.toList(growable: false);
|
||||
}
|
||||
|
||||
Future<void> fetchRules() async {
|
||||
if (!_isLoading) _isLoading = true;
|
||||
notifyListeners();
|
||||
try {
|
||||
var rules = await repository.getRulesList();
|
||||
_rules = rules;
|
||||
_rules = await repository.getRulesList();
|
||||
} on SocketException catch (e) {
|
||||
log(e.toString());
|
||||
_error = 'Check internet connection.';
|
||||
|
||||
@@ -20,8 +20,8 @@ class DefaultLintsPage extends StatelessWidget {
|
||||
return const CircularProgressIndicator.adaptive();
|
||||
}
|
||||
|
||||
if (rulesStore.defaultProfiles.isNotEmpty) {
|
||||
var defaultSets = rulesStore.defaultProfiles;
|
||||
final defaultSets = rulesStore.defaultProfiles;
|
||||
if (defaultSets.isNotEmpty) {
|
||||
final isDesktop = isDisplayLarge(context);
|
||||
final isTablet = isDisplayMedium(context);
|
||||
final startPadding = isTablet
|
||||
@@ -45,7 +45,7 @@ class DefaultLintsPage extends StatelessWidget {
|
||||
cacheExtent: 5,
|
||||
itemCount: defaultSets.length,
|
||||
itemBuilder: (context, index) {
|
||||
var profile = rulesStore.defaultProfiles[index];
|
||||
final profile = defaultSets[index];
|
||||
return ListTile(
|
||||
title: Text(
|
||||
profile.name,
|
||||
|
||||
@@ -20,7 +20,7 @@ class DefaultRulesPage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final isDesktop = isDisplayLarge(context);
|
||||
final isTablet = isDisplayMedium(context);
|
||||
var textTheme = Theme.of(context).textTheme;
|
||||
final textTheme = Theme.of(context).textTheme;
|
||||
final startPadding = isTablet
|
||||
? 60.0
|
||||
: isDesktop
|
||||
|
||||
@@ -19,38 +19,36 @@ class HomePage extends StatelessWidget {
|
||||
return const CircularProgressIndicator.adaptive();
|
||||
}
|
||||
|
||||
if (!rulesStore.isLoading) {
|
||||
if (rulesStore.rules.isNotEmpty) {
|
||||
final isDesktop = isDisplayLarge(context);
|
||||
final isTablet = isDisplayMedium(context);
|
||||
final startPadding = isTablet
|
||||
? 60.0
|
||||
: isDesktop
|
||||
? 120.0
|
||||
: 16.0;
|
||||
final endPadding = isTablet
|
||||
? 60.0
|
||||
: isDesktop
|
||||
? 120.0
|
||||
: 16.0;
|
||||
if (rulesStore.rules.isNotEmpty) {
|
||||
final isDesktop = isDisplayLarge(context);
|
||||
final isTablet = isDisplayMedium(context);
|
||||
final startPadding = isTablet
|
||||
? 60.0
|
||||
: isDesktop
|
||||
? 120.0
|
||||
: 16.0;
|
||||
final endPadding = isTablet
|
||||
? 60.0
|
||||
: isDesktop
|
||||
? 120.0
|
||||
: 16.0;
|
||||
|
||||
return ListView.separated(
|
||||
padding: EdgeInsetsDirectional.only(
|
||||
start: startPadding,
|
||||
end: endPadding,
|
||||
top: isDesktop ? 28 : 16,
|
||||
bottom: isDesktop ? kToolbarHeight : 16,
|
||||
),
|
||||
itemCount: rulesStore.rules.length,
|
||||
cacheExtent: 5,
|
||||
itemBuilder: (context, index) {
|
||||
return LintExpansionTile(
|
||||
rule: rulesStore.rules[index],
|
||||
);
|
||||
},
|
||||
separatorBuilder: (context, index) => const SizedBox(height: 4),
|
||||
);
|
||||
}
|
||||
return ListView.separated(
|
||||
padding: EdgeInsetsDirectional.only(
|
||||
start: startPadding,
|
||||
end: endPadding,
|
||||
top: isDesktop ? 28 : 16,
|
||||
bottom: isDesktop ? kToolbarHeight : 16,
|
||||
),
|
||||
itemCount: rulesStore.rules.length,
|
||||
cacheExtent: 5,
|
||||
itemBuilder: (context, index) {
|
||||
return LintExpansionTile(
|
||||
rule: rulesStore.rules[index],
|
||||
);
|
||||
},
|
||||
separatorBuilder: (context, index) => const SizedBox(height: 4),
|
||||
);
|
||||
}
|
||||
|
||||
return Column(
|
||||
|
||||
@@ -23,7 +23,7 @@ class RulesPage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final isDesktop = isDisplayLarge(context);
|
||||
final isTablet = isDisplayMedium(context);
|
||||
var textTheme = Theme.of(context).textTheme;
|
||||
final textTheme = Theme.of(context).textTheme;
|
||||
final startPadding = isTablet
|
||||
? 60.0
|
||||
: isDesktop
|
||||
@@ -85,7 +85,7 @@ class RulesPage extends StatelessWidget {
|
||||
itemCount: profile.rules.length,
|
||||
cacheExtent: 5,
|
||||
itemBuilder: (context, index) {
|
||||
/// Show righ-click context menu to delete rule.
|
||||
/// Show right-click context menu to delete rule.
|
||||
return ContextMenuRegion(
|
||||
contextMenu: GenericContextMenu(
|
||||
buttonConfigs: [
|
||||
|
||||
@@ -8,8 +8,10 @@ import 'package:linting_tool/model/rule.dart';
|
||||
import 'package:yaml/yaml.dart';
|
||||
|
||||
class APIProvider {
|
||||
final _baseURL = 'https://dart-lang.github.io/linter';
|
||||
static const String _baseURL = 'https://dart-lang.github.io/linter';
|
||||
|
||||
final http.Client httpClient;
|
||||
|
||||
APIProvider(this.httpClient);
|
||||
|
||||
Future<List<Rule>> getRulesList() async {
|
||||
@@ -17,11 +19,10 @@ class APIProvider {
|
||||
await httpClient.get(Uri.parse('$_baseURL//lints/machine/rules.json'));
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
List<Rule> rulesList = [];
|
||||
final data = json.decode(response.body) as List;
|
||||
for (var item in data) {
|
||||
rulesList.add(Rule.fromJson(item as Map<String, dynamic>));
|
||||
}
|
||||
final rulesList = [
|
||||
for (final item in data) Rule.fromJson(item as Map<String, dynamic>)
|
||||
];
|
||||
return rulesList;
|
||||
} else {
|
||||
throw Exception('Failed to load rules');
|
||||
|
||||
@@ -10,7 +10,7 @@ class HiveService {
|
||||
boxName,
|
||||
);
|
||||
|
||||
List<T> existingProducts = await getBoxes(boxName);
|
||||
final List<T> existingProducts = await getBoxes(boxName);
|
||||
|
||||
if (!existingProducts.contains(item)) {
|
||||
await openBox.add(item);
|
||||
@@ -24,9 +24,9 @@ class HiveService {
|
||||
boxName,
|
||||
);
|
||||
|
||||
List<T> existingProducts = await getBoxes(boxName);
|
||||
final Set<T> existingProducts = Set.unmodifiable(await getBoxes(boxName));
|
||||
|
||||
for (var item in items) {
|
||||
for (final item in items) {
|
||||
if (!existingProducts.contains(item)) {
|
||||
await openBox.add(item);
|
||||
}
|
||||
@@ -38,9 +38,9 @@ class HiveService {
|
||||
boxName,
|
||||
);
|
||||
|
||||
List<T> boxes = await getBoxes(boxName);
|
||||
final List<T> boxes = await getBoxes(boxName);
|
||||
|
||||
for (var box in boxes) {
|
||||
for (final box in boxes) {
|
||||
if (box == item) {
|
||||
await openBox.deleteAt(boxes.indexOf(item));
|
||||
}
|
||||
@@ -52,9 +52,9 @@ class HiveService {
|
||||
boxName,
|
||||
);
|
||||
|
||||
List<T> boxes = await getBoxes(boxName);
|
||||
final List<T> boxes = await getBoxes(boxName);
|
||||
|
||||
for (var box in boxes) {
|
||||
for (final box in boxes) {
|
||||
if (box == item) {
|
||||
await openBox.putAt(boxes.indexOf(item), newItem);
|
||||
}
|
||||
@@ -62,15 +62,13 @@ class HiveService {
|
||||
}
|
||||
|
||||
static Future<List<T>> getBoxes<T>(String boxName, [String? query]) async {
|
||||
List<T> boxList = [];
|
||||
|
||||
final openBox = await Hive.openLazyBox<T>(boxName);
|
||||
|
||||
int length = openBox.length;
|
||||
final length = openBox.length;
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
boxList.add(await openBox.getAt(i) as T);
|
||||
}
|
||||
final boxList = <T>[
|
||||
for (int i = 0; i < length; i++) await openBox.getAt(i) as T
|
||||
];
|
||||
|
||||
return boxList;
|
||||
}
|
||||
|
||||
@@ -8,11 +8,9 @@ import 'package:linting_tool/repository/api_provider.dart';
|
||||
import 'package:yaml/yaml.dart';
|
||||
|
||||
class Repository {
|
||||
late final APIProvider _apiProvider;
|
||||
final APIProvider _apiProvider;
|
||||
|
||||
Repository(http.Client httpClient) {
|
||||
_apiProvider = APIProvider(httpClient);
|
||||
}
|
||||
Repository(http.Client httpClient) : _apiProvider = APIProvider(httpClient);
|
||||
|
||||
Future<List<Rule>> getRulesList() => _apiProvider.getRulesList();
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:linting_tool/theme/colors.dart';
|
||||
|
||||
class AppTheme {
|
||||
abstract class AppTheme {
|
||||
static ThemeData buildReplyLightTheme(BuildContext context) {
|
||||
final base = ThemeData.light();
|
||||
return base.copyWith(
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppColors {
|
||||
abstract class AppColors {
|
||||
static const Color white50 = Color(0xFFFFFFFF);
|
||||
|
||||
static const Color black800 = Color(0xFF121212);
|
||||
|
||||
@@ -46,7 +46,7 @@ class _AdaptiveNavState extends State<AdaptiveNav> {
|
||||
),
|
||||
];
|
||||
|
||||
final trailing = <String, IconData>{
|
||||
const trailing = <String, IconData>{
|
||||
'About': Icons.info_outline,
|
||||
};
|
||||
|
||||
@@ -62,25 +62,25 @@ class _NavView extends StatefulWidget {
|
||||
const _NavView({
|
||||
required this.extended,
|
||||
required this.destinations,
|
||||
this.trailing,
|
||||
this.trailing = const {},
|
||||
});
|
||||
|
||||
final bool extended;
|
||||
final List<_Destination> destinations;
|
||||
final Map<String, IconData>? trailing;
|
||||
final Map<String, IconData> trailing;
|
||||
|
||||
@override
|
||||
_NavViewState createState() => _NavViewState();
|
||||
}
|
||||
|
||||
class _NavViewState extends State<_NavView> {
|
||||
late ValueNotifier<bool?> _isExtended;
|
||||
late final ValueNotifier<bool> _isExtended;
|
||||
var _selectedIndex = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_isExtended = ValueNotifier<bool?>(widget.extended);
|
||||
_isExtended = ValueNotifier<bool>(widget.extended);
|
||||
}
|
||||
|
||||
void _onDestinationSelected(int index) {
|
||||
@@ -91,7 +91,7 @@ class _NavViewState extends State<_NavView> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var textTheme = Theme.of(context).textTheme;
|
||||
final textTheme = Theme.of(context).textTheme;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
@@ -115,7 +115,7 @@ class _NavViewState extends State<_NavView> {
|
||||
minHeight: constraints.maxHeight,
|
||||
),
|
||||
child: IntrinsicHeight(
|
||||
child: ValueListenableBuilder<bool?>(
|
||||
child: ValueListenableBuilder<bool>(
|
||||
valueListenable: _isExtended,
|
||||
builder: (context, value, child) {
|
||||
var isSmallDisplay = isDisplaySmall(context);
|
||||
@@ -130,13 +130,13 @@ class _NavViewState extends State<_NavView> {
|
||||
label: Text(destination.textLabel),
|
||||
),
|
||||
],
|
||||
extended: _isExtended.value! && !isSmallDisplay,
|
||||
extended: _isExtended.value && !isSmallDisplay,
|
||||
labelType: NavigationRailLabelType.none,
|
||||
leading: _NavigationRailHeader(
|
||||
extended: _isExtended,
|
||||
),
|
||||
trailing: _NavigationRailTrailingSection(
|
||||
trailingDestinations: widget.trailing!,
|
||||
trailingDestinations: widget.trailing,
|
||||
),
|
||||
selectedIndex: _selectedIndex,
|
||||
onDestinationSelected: _onDestinationSelected,
|
||||
|
||||
@@ -13,6 +13,7 @@ import 'package:provider/provider.dart';
|
||||
|
||||
class LintExpansionTile extends StatefulWidget {
|
||||
final Rule rule;
|
||||
|
||||
const LintExpansionTile({
|
||||
required this.rule,
|
||||
super.key,
|
||||
@@ -24,10 +25,11 @@ class LintExpansionTile extends StatefulWidget {
|
||||
|
||||
class _LintExpansionTileState extends State<LintExpansionTile> {
|
||||
var isExpanded = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var theme = Theme.of(context);
|
||||
var textTheme = theme.textTheme;
|
||||
final theme = Theme.of(context);
|
||||
final textTheme = theme.textTheme;
|
||||
final rule = widget.rule;
|
||||
final incompatibleString =
|
||||
rule.incompatible.isNotEmpty ? rule.incompatible.join(', ') : 'none';
|
||||
@@ -287,8 +289,8 @@ class ExistingProfileDialog extends StatefulWidget {
|
||||
class _ExistingProfileDialogState extends State<ExistingProfileDialog> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var profilesStore = Provider.of<ProfilesStore>(context);
|
||||
var savedProfiles = profilesStore.savedProfiles;
|
||||
final profilesStore = Provider.of<ProfilesStore>(context);
|
||||
final savedProfiles = profilesStore.savedProfiles;
|
||||
return AlertDialog(
|
||||
title: const Text('Select a lint profile'),
|
||||
content: Column(
|
||||
|
||||
@@ -12,6 +12,7 @@ import 'package:provider/provider.dart';
|
||||
|
||||
class SavedRuleTile extends StatefulWidget {
|
||||
final Rule rule;
|
||||
|
||||
const SavedRuleTile({
|
||||
required this.rule,
|
||||
super.key,
|
||||
@@ -27,8 +28,8 @@ class _SavedRuleTileState extends State<SavedRuleTile> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var theme = Theme.of(context);
|
||||
var textTheme = theme.textTheme;
|
||||
final theme = Theme.of(context);
|
||||
final textTheme = theme.textTheme;
|
||||
final rule = widget.rule;
|
||||
final incompatibleString =
|
||||
rule.incompatible.isNotEmpty ? rule.incompatible.join(', ') : 'none';
|
||||
|
||||
@@ -31,7 +31,7 @@ EXTERNAL SOURCES:
|
||||
SPEC CHECKSUMS:
|
||||
file_selector_macos: f1b08a781e66103e3ba279fd5d4024a2478b3af6
|
||||
FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424
|
||||
path_provider_macos: 160cab0d5461f0c0e02995469a98f24bdb9a3f1f
|
||||
path_provider_macos: 3c0c3b4b0d4a76d2bf989a913c2de869c5641a19
|
||||
url_launcher_macos: 597e05b8e514239626bcf4a850fcf9ef5c856ec3
|
||||
window_size: 339dafa0b27a95a62a843042038fa6c3c48de195
|
||||
|
||||
|
||||
@@ -7,35 +7,35 @@ packages:
|
||||
name: _fe_analyzer_shared
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "38.0.0"
|
||||
version: "40.0.0"
|
||||
adaptive_breakpoints:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: adaptive_breakpoints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.1"
|
||||
version: "0.1.2"
|
||||
analyzer:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: analyzer
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.4.1"
|
||||
version: "4.1.0"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: args
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.3.0"
|
||||
version: "2.3.1"
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.8.2"
|
||||
version: "2.9.0"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -77,7 +77,7 @@ packages:
|
||||
name: build_runner
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.10"
|
||||
version: "2.1.11"
|
||||
build_runner_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -105,7 +105,7 @@ packages:
|
||||
name: characters
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.2.1"
|
||||
charcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -203,7 +203,7 @@ packages:
|
||||
name: ffi
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.2"
|
||||
version: "1.2.1"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -217,7 +217,7 @@ packages:
|
||||
name: file_selector
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.8.4+1"
|
||||
version: "0.8.4+2"
|
||||
file_selector_linux:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -231,7 +231,7 @@ packages:
|
||||
name: file_selector_macos
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.8.2"
|
||||
version: "0.8.2+1"
|
||||
file_selector_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -245,21 +245,21 @@ packages:
|
||||
name: file_selector_web
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.8.1+3"
|
||||
version: "0.8.1+5"
|
||||
file_selector_windows:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: file_selector_windows
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.8.2"
|
||||
version: "0.8.2+1"
|
||||
fixnum:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fixnum
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
version: "1.0.1"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
@@ -295,7 +295,7 @@ packages:
|
||||
name: frontend_server_client
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
version: "2.1.3"
|
||||
glob:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -309,7 +309,7 @@ packages:
|
||||
name: google_fonts
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.3.2"
|
||||
version: "3.0.0"
|
||||
graphs:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -323,7 +323,7 @@ packages:
|
||||
name: hive
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
version: "2.2.1"
|
||||
hive_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -337,7 +337,7 @@ packages:
|
||||
name: hive_generator
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.2"
|
||||
version: "1.1.3"
|
||||
http:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -358,7 +358,7 @@ packages:
|
||||
name: http_parser
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
version: "4.0.1"
|
||||
io:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -449,7 +449,7 @@ packages:
|
||||
name: mockito
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.1.0"
|
||||
version: "5.2.0"
|
||||
nested:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -477,49 +477,49 @@ packages:
|
||||
name: path_provider
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.9"
|
||||
version: "2.0.10"
|
||||
path_provider_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_android
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.13"
|
||||
version: "2.0.14"
|
||||
path_provider_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_ios
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.8"
|
||||
version: "2.0.9"
|
||||
path_provider_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_linux
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.5"
|
||||
version: "2.1.6"
|
||||
path_provider_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_macos
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.5"
|
||||
version: "2.0.6"
|
||||
path_provider_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.3"
|
||||
version: "2.0.4"
|
||||
path_provider_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_windows
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.5"
|
||||
version: "2.0.6"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -608,7 +608,7 @@ packages:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.2"
|
||||
version: "1.9.0"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -636,7 +636,7 @@ packages:
|
||||
name: string_scanner
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
version: "1.1.1"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -664,42 +664,42 @@ packages:
|
||||
name: typed_data
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
version: "1.3.1"
|
||||
url_launcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.1.0"
|
||||
version: "6.1.2"
|
||||
url_launcher_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_android
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.0.16"
|
||||
version: "6.0.17"
|
||||
url_launcher_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_ios
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.0.15"
|
||||
version: "6.0.17"
|
||||
url_launcher_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_linux
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
version: "3.0.1"
|
||||
url_launcher_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_macos
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
version: "3.0.1"
|
||||
url_launcher_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -713,14 +713,14 @@ packages:
|
||||
name: url_launcher_web
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.9"
|
||||
version: "2.0.11"
|
||||
url_launcher_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_windows
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
version: "3.0.1"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -748,7 +748,7 @@ packages:
|
||||
name: win32
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.5.2"
|
||||
version: "2.6.1"
|
||||
window_size:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -771,7 +771,7 @@ packages:
|
||||
name: yaml
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.1.0"
|
||||
version: "3.1.1"
|
||||
sdks:
|
||||
dart: ">=2.17.0-206.0.dev <3.0.0"
|
||||
dart: ">=2.17.0 <3.0.0"
|
||||
flutter: ">=2.10.0"
|
||||
|
||||
@@ -20,12 +20,12 @@ dependencies:
|
||||
file_selector_web: ^0.8.1+1
|
||||
file_selector_windows: ^0.8.2
|
||||
flutter_markdown: ^0.6.2
|
||||
google_fonts: ^2.1.0
|
||||
google_fonts: ^3.0.0
|
||||
hive: ^2.0.4
|
||||
hive_flutter: ^1.1.0
|
||||
http: ^0.13.3
|
||||
json2yaml: ^3.0.0
|
||||
json_annotation: ^4.0.1
|
||||
json_annotation: ^4.5.0
|
||||
mockito: ^5.0.13
|
||||
provider: ^6.0.2
|
||||
yaml: ^3.1.0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Mocks generated by Mockito 5.0.13 from annotations
|
||||
// Mocks generated by Mockito 5.2.0 from annotations
|
||||
// in linting_tool/test/widget_test.dart.
|
||||
// Do not manually edit this file.
|
||||
|
||||
@@ -12,6 +12,7 @@ import 'package:http/src/response.dart' as _i2;
|
||||
import 'package:http/src/streamed_response.dart' as _i3;
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: avoid_redundant_argument_values
|
||||
// ignore_for_file: avoid_setters_without_getters
|
||||
// ignore_for_file: comment_references
|
||||
@@ -19,10 +20,12 @@ import 'package:mockito/mockito.dart' as _i1;
|
||||
// ignore_for_file: invalid_use_of_visible_for_testing_member
|
||||
// ignore_for_file: prefer_const_constructors
|
||||
// ignore_for_file: unnecessary_parenthesis
|
||||
// ignore_for_file: camel_case_types
|
||||
|
||||
class _FakeResponse extends _i1.Fake implements _i2.Response {}
|
||||
class _FakeResponse_0 extends _i1.Fake implements _i2.Response {}
|
||||
|
||||
class _FakeStreamedResponse extends _i1.Fake implements _i3.StreamedResponse {}
|
||||
class _FakeStreamedResponse_1 extends _i1.Fake implements _i3.StreamedResponse {
|
||||
}
|
||||
|
||||
/// A class which mocks [Client].
|
||||
///
|
||||
@@ -35,12 +38,12 @@ class MockClient extends _i1.Mock implements _i4.Client {
|
||||
@override
|
||||
_i5.Future<_i2.Response> head(Uri? url, {Map<String, String>? headers}) =>
|
||||
(super.noSuchMethod(Invocation.method(#head, [url], {#headers: headers}),
|
||||
returnValue: Future<_i2.Response>.value(_FakeResponse()))
|
||||
returnValue: Future<_i2.Response>.value(_FakeResponse_0()))
|
||||
as _i5.Future<_i2.Response>);
|
||||
@override
|
||||
_i5.Future<_i2.Response> get(Uri? url, {Map<String, String>? headers}) =>
|
||||
(super.noSuchMethod(Invocation.method(#get, [url], {#headers: headers}),
|
||||
returnValue: Future<_i2.Response>.value(_FakeResponse()))
|
||||
returnValue: Future<_i2.Response>.value(_FakeResponse_0()))
|
||||
as _i5.Future<_i2.Response>);
|
||||
@override
|
||||
_i5.Future<_i2.Response> post(Uri? url,
|
||||
@@ -50,7 +53,7 @@ class MockClient extends _i1.Mock implements _i4.Client {
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#post, [url],
|
||||
{#headers: headers, #body: body, #encoding: encoding}),
|
||||
returnValue: Future<_i2.Response>.value(_FakeResponse()))
|
||||
returnValue: Future<_i2.Response>.value(_FakeResponse_0()))
|
||||
as _i5.Future<_i2.Response>);
|
||||
@override
|
||||
_i5.Future<_i2.Response> put(Uri? url,
|
||||
@@ -60,7 +63,7 @@ class MockClient extends _i1.Mock implements _i4.Client {
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#put, [url],
|
||||
{#headers: headers, #body: body, #encoding: encoding}),
|
||||
returnValue: Future<_i2.Response>.value(_FakeResponse()))
|
||||
returnValue: Future<_i2.Response>.value(_FakeResponse_0()))
|
||||
as _i5.Future<_i2.Response>);
|
||||
@override
|
||||
_i5.Future<_i2.Response> patch(Uri? url,
|
||||
@@ -70,7 +73,7 @@ class MockClient extends _i1.Mock implements _i4.Client {
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#patch, [url],
|
||||
{#headers: headers, #body: body, #encoding: encoding}),
|
||||
returnValue: Future<_i2.Response>.value(_FakeResponse()))
|
||||
returnValue: Future<_i2.Response>.value(_FakeResponse_0()))
|
||||
as _i5.Future<_i2.Response>);
|
||||
@override
|
||||
_i5.Future<_i2.Response> delete(Uri? url,
|
||||
@@ -80,7 +83,7 @@ class MockClient extends _i1.Mock implements _i4.Client {
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#delete, [url],
|
||||
{#headers: headers, #body: body, #encoding: encoding}),
|
||||
returnValue: Future<_i2.Response>.value(_FakeResponse()))
|
||||
returnValue: Future<_i2.Response>.value(_FakeResponse_0()))
|
||||
as _i5.Future<_i2.Response>);
|
||||
@override
|
||||
_i5.Future<String> read(Uri? url, {Map<String, String>? headers}) =>
|
||||
@@ -97,11 +100,9 @@ class MockClient extends _i1.Mock implements _i4.Client {
|
||||
_i5.Future<_i3.StreamedResponse> send(_i8.BaseRequest? request) =>
|
||||
(super.noSuchMethod(Invocation.method(#send, [request]),
|
||||
returnValue:
|
||||
Future<_i3.StreamedResponse>.value(_FakeStreamedResponse()))
|
||||
Future<_i3.StreamedResponse>.value(_FakeStreamedResponse_1()))
|
||||
as _i5.Future<_i3.StreamedResponse>);
|
||||
@override
|
||||
void close() => super.noSuchMethod(Invocation.method(#close, []),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
String toString() => super.toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user