mirror of
https://github.com/flutter/packages.git
synced 2025-06-28 22:02:38 +08:00
[analysis_options] sync lint rules with flutter/flutter (#2495)
This commit is contained in:

committed by
GitHub

parent
4280a6e029
commit
88585ef988
@ -1,35 +1,27 @@
|
||||
# Specify analysis options.
|
||||
#
|
||||
# Until there are meta linter rules, each desired lint must be explicitly enabled.
|
||||
# See: https://github.com/dart-lang/linter/issues/288
|
||||
#
|
||||
# For a list of lints, see: http://dart-lang.github.io/linter/lints/
|
||||
# See the configuration guide for more
|
||||
# https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer
|
||||
#
|
||||
# This file is derived from the master file in the flutter repo, and should be
|
||||
# kept in sync with it.
|
||||
# This file is a copy of analysis_options.yaml from flutter repo
|
||||
# as of 2022-07-27, but with some modifications marked with
|
||||
# "DIFFERENT FROM FLUTTER/FLUTTER" below. The file is expected to
|
||||
# be kept in sync with the master file from the flutter repo.
|
||||
|
||||
analyzer:
|
||||
strong-mode:
|
||||
implicit-dynamic: false
|
||||
language:
|
||||
strict-casts: false # DIFFERENT FROM FLUTTER/FLUTTER, too many violations, TODO(goderbauer): Clean this up.
|
||||
strict-raw-types: true
|
||||
errors:
|
||||
# treat missing required parameters as a warning (not a hint)
|
||||
missing_required_param: warning
|
||||
# treat missing returns as a warning (not a hint)
|
||||
missing_return: warning
|
||||
# allow having TODOs in the code
|
||||
todo: ignore
|
||||
# allow self-reference to deprecated members (we do this because otherwise we have
|
||||
# to annotate every member in every test, assert, etc, when we deprecate something)
|
||||
deprecated_member_use_from_same_package: ignore
|
||||
# Turned off until null-safe rollout is complete.
|
||||
unnecessary_null_comparison: ignore
|
||||
exclude:
|
||||
exclude: # DIFFERENT FROM FLUTTER/FLUTTER
|
||||
# Ignore generated files
|
||||
- '**/*.mocks.dart' # Mockito @GenerateMocks
|
||||
|
||||
linter:
|
||||
rules:
|
||||
# these rules are documented on and in the same order as
|
||||
# the Dart Lint rules page to make maintenance easier
|
||||
# This list is derived from the list of all available lints located at
|
||||
# https://github.com/dart-lang/linter/blob/master/example/all.yaml
|
||||
- always_declare_return_types
|
||||
- always_put_control_body_on_new_line
|
||||
@ -40,32 +32,34 @@ linter:
|
||||
- annotate_overrides
|
||||
# - avoid_annotating_with_dynamic # conflicts with always_specify_types
|
||||
- avoid_bool_literals_in_conditional_expressions
|
||||
# - avoid_catches_without_on_clauses # we do this commonly
|
||||
# - avoid_catching_errors # we do this commonly
|
||||
# - avoid_catches_without_on_clauses # blocked on https://github.com/dart-lang/linter/issues/3023
|
||||
# - avoid_catching_errors # blocked on https://github.com/dart-lang/linter/issues/3023
|
||||
- avoid_classes_with_only_static_members
|
||||
# - avoid_double_and_int_checks # only useful when targeting JS runtime
|
||||
# - avoid_dynamic_calls # not yet tested
|
||||
- avoid_double_and_int_checks
|
||||
- avoid_dynamic_calls
|
||||
- avoid_empty_else
|
||||
- avoid_equals_and_hash_code_on_mutable_classes
|
||||
# - avoid_escaping_inner_quotes # not yet tested
|
||||
- avoid_escaping_inner_quotes
|
||||
- avoid_field_initializers_in_const_classes
|
||||
# - avoid_final_parameters # incompatible with prefer_final_parameters
|
||||
- avoid_function_literals_in_foreach_calls
|
||||
# - avoid_implementing_value_types # not yet tested
|
||||
- avoid_implementing_value_types
|
||||
- avoid_init_to_null
|
||||
# - avoid_js_rounded_ints # only useful when targeting JS runtime
|
||||
- avoid_js_rounded_ints
|
||||
# - avoid_multiple_declarations_per_line # seems to be a stylistic choice we don't subscribe to
|
||||
- avoid_null_checks_in_equality_operators
|
||||
# - avoid_positional_boolean_parameters # not yet tested
|
||||
# - avoid_print # not yet tested
|
||||
# - avoid_positional_boolean_parameters # would have been nice to enable this but by now there's too many places that break it
|
||||
- avoid_print
|
||||
# - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
|
||||
# - avoid_redundant_argument_values # not yet tested
|
||||
- avoid_redundant_argument_values
|
||||
- avoid_relative_lib_imports
|
||||
- avoid_renaming_method_parameters
|
||||
- avoid_return_types_on_setters
|
||||
# - avoid_returning_null # there are plenty of valid reasons to return null
|
||||
# - avoid_returning_null_for_future # not yet tested
|
||||
- avoid_returning_null
|
||||
- avoid_returning_null_for_future
|
||||
- avoid_returning_null_for_void
|
||||
# - avoid_returning_this # there are plenty of valid reasons to return this
|
||||
# - avoid_setters_without_getters # not yet tested
|
||||
# - avoid_returning_this # there are enough valid reasons to return `this` that this lint ends up with too many false positives
|
||||
- avoid_setters_without_getters
|
||||
- avoid_shadowing_type_parameters
|
||||
- avoid_single_cascade_in_expression_statements
|
||||
- avoid_slow_async_io
|
||||
@ -75,51 +69,59 @@ linter:
|
||||
- avoid_unnecessary_containers
|
||||
- avoid_unused_constructor_parameters
|
||||
- avoid_void_async
|
||||
# - avoid_web_libraries_in_flutter # not yet tested
|
||||
# - avoid_web_libraries_in_flutter # we use web libraries in web-specific code, and our tests prevent us from using them elsewhere
|
||||
- await_only_futures
|
||||
- camel_case_extensions
|
||||
- camel_case_types
|
||||
- cancel_subscriptions
|
||||
# - cascade_invocations # not yet tested
|
||||
# - cascade_invocations # doesn't match the typical style of this repo
|
||||
- cast_nullable_to_non_nullable
|
||||
# - close_sinks # not reliable enough
|
||||
- combinators_ordering
|
||||
# - comment_references # blocked on https://github.com/dart-lang/linter/issues/1142
|
||||
- conditional_uri_does_not_exist
|
||||
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
|
||||
- control_flow_in_finally
|
||||
# - curly_braces_in_flow_control_structures # not required by flutter style
|
||||
- curly_braces_in_flow_control_structures
|
||||
- depend_on_referenced_packages
|
||||
- deprecated_consistency
|
||||
# - diagnostic_describe_all_properties # not yet tested
|
||||
# - diagnostic_describe_all_properties # enabled only at the framework level (packages/flutter/lib)
|
||||
- directives_ordering
|
||||
# - do_not_use_environment # we do this commonly
|
||||
# - discarded_futures # not yet tested
|
||||
# - do_not_use_environment # there are appropriate times to use the environment, especially in our tests and build logic
|
||||
- empty_catches
|
||||
- empty_constructor_bodies
|
||||
- empty_statements
|
||||
- eol_at_end_of_file
|
||||
- exhaustive_cases
|
||||
- file_names
|
||||
- flutter_style_todos
|
||||
- hash_and_equals
|
||||
- implementation_imports
|
||||
# - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811
|
||||
- iterable_contains_unrelated_type
|
||||
# - join_return_with_assignment # not required by flutter style
|
||||
- leading_newlines_in_multiline_strings
|
||||
- library_names
|
||||
- library_prefixes
|
||||
- library_private_types_in_public_api
|
||||
# - lines_longer_than_80_chars # not required by flutter style
|
||||
- list_remove_unrelated_type
|
||||
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181
|
||||
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/linter/issues/453
|
||||
- missing_whitespace_between_adjacent_strings
|
||||
- no_adjacent_strings_in_list
|
||||
# - no_default_cases # too many false positives
|
||||
- no_default_cases
|
||||
- no_duplicate_case_values
|
||||
- no_leading_underscores_for_library_prefixes
|
||||
- no_leading_underscores_for_local_identifiers
|
||||
- no_logic_in_create_state
|
||||
# - no_runtimeType_toString # ok in tests; we enable this only in packages/
|
||||
- non_constant_identifier_names
|
||||
- noop_primitive_operations
|
||||
- null_check_on_nullable_type_parameter
|
||||
- null_closures
|
||||
# - omit_local_variable_types # opposite of always_specify_types
|
||||
# - one_member_abstracts # too many false positives
|
||||
# - only_throw_errors # https://github.com/flutter/flutter/issues/5792
|
||||
- only_throw_errors # this does get disabled in a few places where we have legacy code that uses strings et al
|
||||
- overridden_fields
|
||||
- package_api_docs
|
||||
- package_names
|
||||
@ -142,6 +144,7 @@ linter:
|
||||
- prefer_final_fields
|
||||
- prefer_final_in_for_each
|
||||
- prefer_final_locals
|
||||
# - prefer_final_parameters # we should enable this one day when it can be auto-fixed (https://github.com/dart-lang/linter/issues/3104), see also parameter_assignments
|
||||
- prefer_for_elements_to_map_fromIterable
|
||||
- prefer_foreach
|
||||
- prefer_function_declarations_over_variables
|
||||
@ -151,68 +154,78 @@ linter:
|
||||
- prefer_initializing_formals
|
||||
- prefer_inlined_adds
|
||||
# - prefer_int_literals # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#use-double-literals-for-double-constants
|
||||
# - prefer_interpolation_to_compose_strings # doesn't work with raw strings, see https://github.com/dart-lang/linter/issues/2490
|
||||
- prefer_interpolation_to_compose_strings
|
||||
- prefer_is_empty
|
||||
- prefer_is_not_empty
|
||||
- prefer_is_not_operator
|
||||
- prefer_iterable_whereType
|
||||
# - prefer_mixin # https://github.com/dart-lang/language/issues/32
|
||||
# - prefer_mixin # Has false positives, see https://github.com/dart-lang/linter/issues/3018
|
||||
# - prefer_null_aware_method_calls # "call()" is confusing to people new to the language since it's not documented anywhere
|
||||
- prefer_null_aware_operators
|
||||
# - prefer_relative_imports # incompatible with sub-package imports
|
||||
- prefer_relative_imports
|
||||
- prefer_single_quotes
|
||||
- prefer_spread_collections
|
||||
- prefer_typing_uninitialized_variables
|
||||
- prefer_void_to_null
|
||||
- provide_deprecation_message
|
||||
- public_member_api_docs
|
||||
- public_member_api_docs # DIFFERENT FROM FLUTTER/FLUTTER
|
||||
- recursive_getters
|
||||
# - require_trailing_commas # blocked on https://github.com/dart-lang/sdk/issues/47441
|
||||
- secure_pubspec_urls
|
||||
- sized_box_for_whitespace
|
||||
# - sized_box_shrink_expand # not yet tested
|
||||
- slash_for_doc_comments
|
||||
# - sort_child_properties_last # not yet tested
|
||||
- sort_child_properties_last
|
||||
- sort_constructors_first
|
||||
# - sort_pub_dependencies
|
||||
- sort_pub_dependencies # DIFFERENT FROM FLUTTER/FLUTTER: Flutter's use case for not sorting does not apply to this repository.
|
||||
- sort_unnamed_constructors_first
|
||||
- test_types_in_equals
|
||||
- throw_in_finally
|
||||
- tighten_type_of_initializing_formals
|
||||
# - type_annotate_public_apis # subset of always_specify_types
|
||||
- type_init_formals
|
||||
# - unawaited_futures # too many false positives
|
||||
# - unawaited_futures # too many false positives, especially with the way AnimationController works
|
||||
- unnecessary_await_in_return
|
||||
- unnecessary_brace_in_string_interps
|
||||
- unnecessary_const
|
||||
- unnecessary_constructor_name
|
||||
# - unnecessary_final # conflicts with prefer_final_locals
|
||||
- unnecessary_getters_setters
|
||||
# - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
|
||||
- unnecessary_late
|
||||
- unnecessary_new
|
||||
- unnecessary_null_aware_assignments
|
||||
# - unnecessary_null_checks # not yet tested
|
||||
- unnecessary_null_aware_operator_on_extension_on_nullable
|
||||
- unnecessary_null_checks
|
||||
- unnecessary_null_in_if_null_operators
|
||||
- unnecessary_nullable_for_final_variable_declarations
|
||||
- unnecessary_overrides
|
||||
- unnecessary_parenthesis
|
||||
# - unnecessary_raw_strings # not yet tested
|
||||
# - unnecessary_raw_strings # what's "necessary" is a matter of opinion; consistency across strings can help readability more than this lint
|
||||
- unnecessary_statements
|
||||
- unnecessary_string_escapes
|
||||
- unnecessary_string_interpolations
|
||||
- unnecessary_this
|
||||
- unnecessary_to_list_in_spreads
|
||||
- unrelated_type_equality_checks
|
||||
# - unsafe_html # not yet tested
|
||||
- unsafe_html
|
||||
- use_build_context_synchronously
|
||||
# - use_colored_box # not yet tested
|
||||
# - use_decorated_box # not yet tested
|
||||
# - use_enums # not yet tested
|
||||
- use_full_hex_values_for_flutter_colors
|
||||
- use_function_type_syntax_for_parameters
|
||||
# - use_if_null_to_convert_nulls_to_bools # not yet tested
|
||||
- use_if_null_to_convert_nulls_to_bools
|
||||
- use_is_even_rather_than_modulo
|
||||
- use_key_in_widget_constructors
|
||||
- use_late_for_private_fields_and_variables
|
||||
# - use_named_constants # not yet yested
|
||||
- use_named_constants
|
||||
- use_raw_strings
|
||||
- use_rethrow_when_possible
|
||||
# - use_setters_to_change_properties # not yet tested
|
||||
- use_setters_to_change_properties
|
||||
# - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182
|
||||
- use_super_parameters
|
||||
- use_test_throws_matchers
|
||||
# - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
|
||||
- valid_regexps
|
||||
- void_checks
|
||||
### Local flutter/packages changes ###
|
||||
# Flutter has a specific use case for dependencies that are intentionally
|
||||
# not sorted, which doesn't apply to this repo.
|
||||
- sort_pub_dependencies
|
||||
|
@ -225,7 +225,6 @@ class _MyHomePageState extends State<MyHomePage>
|
||||
leading: ScaleTransition(
|
||||
scale: _controller1, child: const _MediumComposeIcon()),
|
||||
backgroundColor: const Color.fromARGB(0, 255, 255, 255),
|
||||
labelType: NavigationRailLabelType.none,
|
||||
destinations: <NavigationRailDestination>[
|
||||
slideInNavigationItem(
|
||||
begin: -1,
|
||||
@ -288,7 +287,7 @@ class _MyHomePageState extends State<MyHomePage>
|
||||
padding: const EdgeInsets.fromLTRB(0, 32, 0, 0),
|
||||
child: _ItemList(
|
||||
selected: selected,
|
||||
items: allItems,
|
||||
items: _allItems,
|
||||
selectCard: selectCard),
|
||||
)
|
||||
: const _ExamplePage(),
|
||||
@ -304,7 +303,7 @@ class _MyHomePageState extends State<MyHomePage>
|
||||
outAnimation: AdaptiveScaffold.stayOnScreen,
|
||||
key: const Key('sBody'),
|
||||
builder: (_) => SafeArea(
|
||||
child: _DetailTile(item: allItems[selected ?? 0]),
|
||||
child: _DetailTile(item: _allItems[selected ?? 0]),
|
||||
),
|
||||
)
|
||||
},
|
||||
@ -451,6 +450,8 @@ class _LargeComposeIcon extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
typedef _CardSelectedCallback = void Function(int?);
|
||||
|
||||
// ItemList creates the list of cards and the search bar.
|
||||
class _ItemList extends StatelessWidget {
|
||||
const _ItemList({
|
||||
@ -462,7 +463,7 @@ class _ItemList extends StatelessWidget {
|
||||
|
||||
final List<_Item> items;
|
||||
final int? selected;
|
||||
final Function selectCard;
|
||||
final _CardSelectedCallback selectCard;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -535,7 +536,7 @@ class _ItemListTile extends StatelessWidget {
|
||||
final _Item item;
|
||||
final _Email email;
|
||||
final int? selected;
|
||||
final Function selectCard;
|
||||
final _CardSelectedCallback selectCard;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -545,19 +546,19 @@ class _ItemListTile extends StatelessWidget {
|
||||
// than large screens.
|
||||
// Small screens open a modal with the detail view while large screens
|
||||
// simply show the details on the secondaryBody.
|
||||
selectCard(allItems.indexOf(item));
|
||||
selectCard(_allItems.indexOf(item));
|
||||
if (!Breakpoints.mediumAndUp.isActive(context)) {
|
||||
Navigator.of(context).pushNamed(_ExtractRouteArguments.routeName,
|
||||
arguments: _ScreenArguments(item: item, selectCard: selectCard));
|
||||
} else {
|
||||
selectCard(allItems.indexOf(item));
|
||||
selectCard(_allItems.indexOf(item));
|
||||
}
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: selected == allItems.indexOf(item)
|
||||
color: selected == _allItems.indexOf(item)
|
||||
? const Color.fromARGB(255, 234, 222, 255)
|
||||
: const Color.fromARGB(255, 243, 237, 247),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
||||
@ -863,7 +864,7 @@ class _ScreenArguments {
|
||||
required this.selectCard,
|
||||
});
|
||||
final _Item item;
|
||||
final Function selectCard;
|
||||
final _CardSelectedCallback selectCard;
|
||||
}
|
||||
|
||||
class _ExtractRouteArguments extends StatelessWidget {
|
||||
@ -888,7 +889,7 @@ class _RouteDetailView extends StatelessWidget {
|
||||
}) : super(key: key);
|
||||
|
||||
final _Item item;
|
||||
final Function selectCard;
|
||||
final _CardSelectedCallback selectCard;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -952,7 +953,7 @@ class _Email {
|
||||
|
||||
/// List of items, each representing a thread of emails which will populate
|
||||
/// the different layouts.
|
||||
const List<_Item> allItems = <_Item>[
|
||||
const List<_Item> _allItems = <_Item>[
|
||||
_Item(
|
||||
title: 'Dinner Club',
|
||||
emails: <_Email>[
|
||||
|
@ -84,7 +84,7 @@ void main() {
|
||||
expect(tester.getBottomLeft(bn), const Offset(0, 800));
|
||||
expect(tester.getBottomRight(bn), const Offset(400, 800));
|
||||
expect(tester.getTopRight(body), const Offset(400, 0));
|
||||
expect(tester.getTopLeft(body), const Offset(0, 0));
|
||||
expect(tester.getTopLeft(body), Offset.zero);
|
||||
});
|
||||
|
||||
testWidgets('adaptive layout does not animate when animations off',
|
||||
|
@ -357,7 +357,6 @@ class AdaptiveScaffold extends StatefulWidget {
|
||||
controller: ScrollController(),
|
||||
shrinkWrap: true,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
scrollDirection: Axis.vertical,
|
||||
slivers: <Widget>[
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
|
@ -1,6 +1,7 @@
|
||||
## NEXT
|
||||
## 2.0.4
|
||||
|
||||
* Updates text theme parameters to avoid deprecation issues.
|
||||
* Fixes lint warnings.
|
||||
|
||||
## 2.0.3
|
||||
* Updates for non-nullable bindings.
|
||||
|
@ -44,7 +44,7 @@ class OpenContainerTransformDemo extends StatefulWidget {
|
||||
const OpenContainerTransformDemo({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_OpenContainerTransformDemoState createState() {
|
||||
State<OpenContainerTransformDemo> createState() {
|
||||
return _OpenContainerTransformDemoState();
|
||||
}
|
||||
}
|
||||
@ -54,11 +54,12 @@ class _OpenContainerTransformDemoState
|
||||
ContainerTransitionType _transitionType = ContainerTransitionType.fade;
|
||||
|
||||
void _showMarkedAsDoneSnackbar(bool? isMarkedAsDone) {
|
||||
if (isMarkedAsDone ?? false)
|
||||
if (isMarkedAsDone ?? false) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||
content: Text('Marked as done!'),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
void _showSettingsBottomModalSheet(BuildContext context) {
|
||||
showModalBottomSheet<void>(
|
||||
@ -464,7 +465,6 @@ class _InkWellOverlay extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: height,
|
||||
width: null,
|
||||
child: InkWell(
|
||||
onTap: openContainer,
|
||||
child: child,
|
||||
|
@ -11,7 +11,7 @@ class FadeScaleTransitionDemo extends StatefulWidget {
|
||||
const FadeScaleTransitionDemo({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_FadeScaleTransitionDemoState createState() =>
|
||||
State<FadeScaleTransitionDemo> createState() =>
|
||||
_FadeScaleTransitionDemoState();
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class FadeThroughTransitionDemo extends StatefulWidget {
|
||||
const FadeThroughTransitionDemo({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_FadeThroughTransitionDemoState createState() =>
|
||||
State<FadeThroughTransitionDemo> createState() =>
|
||||
_FadeThroughTransitionDemoState();
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class SharedAxisTransitionDemo extends StatefulWidget {
|
||||
const SharedAxisTransitionDemo({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_SharedAxisTransitionDemoState createState() {
|
||||
State<SharedAxisTransitionDemo> createState() {
|
||||
return _SharedAxisTransitionDemoState();
|
||||
}
|
||||
}
|
||||
@ -43,7 +43,6 @@ class _SharedAxisTransitionDemoState extends State<SharedAxisTransitionDemo> {
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
reverse: !_isLoggedIn,
|
||||
transitionBuilder: (
|
||||
Widget child,
|
||||
@ -51,10 +50,10 @@ class _SharedAxisTransitionDemoState extends State<SharedAxisTransitionDemo> {
|
||||
Animation<double> secondaryAnimation,
|
||||
) {
|
||||
return SharedAxisTransition(
|
||||
child: child,
|
||||
animation: animation,
|
||||
secondaryAnimation: secondaryAnimation,
|
||||
transitionType: _transitionType!,
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
child: _isLoggedIn ? _CoursePage() : _SignInPage(),
|
||||
|
@ -239,8 +239,8 @@ class _ZoomedFadeInFadeOut extends StatelessWidget {
|
||||
Widget? child,
|
||||
) {
|
||||
return _FadeOut(
|
||||
child: child,
|
||||
animation: animation,
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
child: child,
|
||||
|
@ -131,6 +131,8 @@ class _ModalRoute<T> extends PopupRoute<T> {
|
||||
) {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
return Semantics(
|
||||
scopesRoute: true,
|
||||
explicitChildNodes: true,
|
||||
child: SafeArea(
|
||||
child: Builder(
|
||||
builder: (BuildContext context) {
|
||||
@ -139,8 +141,6 @@ class _ModalRoute<T> extends PopupRoute<T> {
|
||||
},
|
||||
),
|
||||
),
|
||||
scopesRoute: true,
|
||||
explicitChildNodes: true,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,7 @@ class OpenContainer<T extends Object?> extends StatefulWidget {
|
||||
final Clip clipBehavior;
|
||||
|
||||
@override
|
||||
_OpenContainerState<T> createState() => _OpenContainerState<T>();
|
||||
State<OpenContainer<T?>> createState() => _OpenContainerState<T>();
|
||||
}
|
||||
|
||||
class _OpenContainerState<T> extends State<OpenContainer<T?>> {
|
||||
|
@ -265,13 +265,13 @@ class PageTransitionSwitcher extends StatefulWidget {
|
||||
/// signature.
|
||||
static Widget defaultLayoutBuilder(List<Widget> entries) {
|
||||
return Stack(
|
||||
children: entries,
|
||||
alignment: Alignment.center,
|
||||
children: entries,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
_PageTransitionSwitcherState createState() => _PageTransitionSwitcherState();
|
||||
State<PageTransitionSwitcher> createState() => _PageTransitionSwitcherState();
|
||||
}
|
||||
|
||||
class _PageTransitionSwitcherState extends State<PageTransitionSwitcher>
|
||||
|
@ -2,7 +2,7 @@ name: animations
|
||||
description: Fancy pre-built animations that can easily be integrated into any Flutter application.
|
||||
repository: https://github.com/flutter/packages/tree/main/packages/animations
|
||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+animations%22
|
||||
version: 2.0.3
|
||||
version: 2.0.4
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
|
@ -20,7 +20,6 @@ void main() {
|
||||
onPressed: () {
|
||||
showModal<void>(
|
||||
context: context,
|
||||
configuration: const FadeScaleTransitionConfiguration(),
|
||||
builder: (BuildContext context) {
|
||||
return const _FlutterLogoModal();
|
||||
},
|
||||
@ -52,7 +51,6 @@ void main() {
|
||||
onPressed: () {
|
||||
showModal<void>(
|
||||
context: context,
|
||||
configuration: const FadeScaleTransitionConfiguration(),
|
||||
builder: (BuildContext context) {
|
||||
return _FlutterLogoModal(key: key);
|
||||
},
|
||||
@ -120,7 +118,6 @@ void main() {
|
||||
onPressed: () {
|
||||
showModal<void>(
|
||||
context: context,
|
||||
configuration: const FadeScaleTransitionConfiguration(),
|
||||
builder: (BuildContext context) {
|
||||
return _FlutterLogoModal(key: key);
|
||||
},
|
||||
@ -185,7 +182,6 @@ void main() {
|
||||
onPressed: () {
|
||||
showModal<void>(
|
||||
context: context,
|
||||
configuration: const FadeScaleTransitionConfiguration(),
|
||||
builder: (BuildContext context) {
|
||||
return _FlutterLogoModal(key: key);
|
||||
},
|
||||
@ -286,8 +282,6 @@ void main() {
|
||||
onPressed: () {
|
||||
showModal<void>(
|
||||
context: context,
|
||||
configuration:
|
||||
const FadeScaleTransitionConfiguration(),
|
||||
builder: (BuildContext context) {
|
||||
return _FlutterLogoModal(
|
||||
key: topKey,
|
||||
|
@ -376,9 +376,9 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
child: Center(
|
||||
child: FadeThroughTransition(
|
||||
child: const _StatefulTestWidget(name: 'Foo'),
|
||||
animation: animation,
|
||||
secondaryAnimation: secondaryAnimation,
|
||||
child: const _StatefulTestWidget(name: 'Foo'),
|
||||
),
|
||||
),
|
||||
));
|
||||
|
@ -1622,7 +1622,7 @@ void main() {
|
||||
expect(material.clipBehavior, Clip.none);
|
||||
});
|
||||
|
||||
Widget _createRootNavigatorTest({
|
||||
Widget createRootNavigatorTest({
|
||||
required Key appKey,
|
||||
required Key nestedNavigatorKey,
|
||||
required bool useRootNavigator,
|
||||
@ -1670,7 +1670,7 @@ void main() {
|
||||
const Key appKey = Key('App');
|
||||
const Key nestedNavigatorKey = Key('Nested Navigator');
|
||||
|
||||
await tester.pumpWidget(_createRootNavigatorTest(
|
||||
await tester.pumpWidget(createRootNavigatorTest(
|
||||
appKey: appKey,
|
||||
nestedNavigatorKey: nestedNavigatorKey,
|
||||
useRootNavigator: false));
|
||||
@ -1693,7 +1693,7 @@ void main() {
|
||||
const Key appKey = Key('App');
|
||||
const Key nestedNavigatorKey = Key('Nested Navigator');
|
||||
|
||||
await tester.pumpWidget(_createRootNavigatorTest(
|
||||
await tester.pumpWidget(createRootNavigatorTest(
|
||||
appKey: appKey,
|
||||
nestedNavigatorKey: nestedNavigatorKey,
|
||||
useRootNavigator: true));
|
||||
@ -1716,7 +1716,7 @@ void main() {
|
||||
const Key appKey = Key('App');
|
||||
const Key nestedNavigatorKey = Key('Nested Navigator');
|
||||
|
||||
await tester.pumpWidget(_createRootNavigatorTest(
|
||||
await tester.pumpWidget(createRootNavigatorTest(
|
||||
appKey: appKey,
|
||||
nestedNavigatorKey: nestedNavigatorKey,
|
||||
useRootNavigator: false));
|
||||
@ -1733,7 +1733,7 @@ void main() {
|
||||
const Key appKey = Key('App');
|
||||
const Key nestedNavigatorKey = Key('Nested Navigator');
|
||||
|
||||
await tester.pumpWidget(_createRootNavigatorTest(
|
||||
await tester.pumpWidget(createRootNavigatorTest(
|
||||
appKey: appKey,
|
||||
nestedNavigatorKey: nestedNavigatorKey,
|
||||
useRootNavigator: true));
|
||||
@ -1786,7 +1786,7 @@ void main() {
|
||||
|
||||
// Regression test for https://github.com/flutter/flutter/issues/72238.
|
||||
testWidgets(
|
||||
'OpenContainer\'s source widget is visible in closed container route if '
|
||||
"OpenContainer's source widget is visible in closed container route if "
|
||||
'open container route is pushed from not using the OpenContainer itself',
|
||||
(WidgetTester tester) async {
|
||||
final Widget openContainer = OpenContainer(
|
||||
|
@ -14,37 +14,37 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Container(key: containerOne, color: const Color(0x00000000)),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
child: Container(key: containerOne, color: const Color(0x00000000)),
|
||||
),
|
||||
);
|
||||
|
||||
Map<Key, double> _primaryAnimation =
|
||||
Map<Key, double> primaryAnimation =
|
||||
_getPrimaryAnimation(<Key>[containerOne], tester);
|
||||
Map<Key, double> _secondaryAnimation =
|
||||
Map<Key, double> secondaryAnimation =
|
||||
_getSecondaryAnimation(<Key>[containerOne], tester);
|
||||
expect(_primaryAnimation[containerOne], equals(1.0));
|
||||
expect(_secondaryAnimation[containerOne], equals(0.0));
|
||||
expect(primaryAnimation[containerOne], equals(1.0));
|
||||
expect(secondaryAnimation[containerOne], equals(0.0));
|
||||
|
||||
await tester.pumpWidget(
|
||||
PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Container(key: containerTwo, color: const Color(0xff000000)),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
child: Container(key: containerTwo, color: const Color(0xff000000)),
|
||||
),
|
||||
);
|
||||
await tester.pump(const Duration(milliseconds: 40));
|
||||
|
||||
_primaryAnimation =
|
||||
primaryAnimation =
|
||||
_getPrimaryAnimation(<Key>[containerOne, containerTwo], tester);
|
||||
_secondaryAnimation =
|
||||
secondaryAnimation =
|
||||
_getSecondaryAnimation(<Key>[containerOne, containerTwo], tester);
|
||||
// Secondary is running for outgoing widget.
|
||||
expect(_primaryAnimation[containerOne], equals(1.0));
|
||||
expect(_secondaryAnimation[containerOne], moreOrLessEquals(0.4));
|
||||
expect(primaryAnimation[containerOne], equals(1.0));
|
||||
expect(secondaryAnimation[containerOne], moreOrLessEquals(0.4));
|
||||
// Primary is running for incoming widget.
|
||||
expect(_primaryAnimation[containerTwo], moreOrLessEquals(0.4));
|
||||
expect(_secondaryAnimation[containerTwo], equals(0.0));
|
||||
expect(primaryAnimation[containerTwo], moreOrLessEquals(0.4));
|
||||
expect(secondaryAnimation[containerTwo], equals(0.0));
|
||||
|
||||
// Container one is underneath container two
|
||||
final Container container = tester.firstWidget(find.byType(Container));
|
||||
@ -53,22 +53,22 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Container(key: containerThree, color: const Color(0xffff0000)),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
child: Container(key: containerThree, color: const Color(0xffff0000)),
|
||||
),
|
||||
);
|
||||
await tester.pump(const Duration(milliseconds: 20));
|
||||
|
||||
_primaryAnimation = _getPrimaryAnimation(
|
||||
primaryAnimation = _getPrimaryAnimation(
|
||||
<Key>[containerOne, containerTwo, containerThree], tester);
|
||||
_secondaryAnimation = _getSecondaryAnimation(
|
||||
secondaryAnimation = _getSecondaryAnimation(
|
||||
<Key>[containerOne, containerTwo, containerThree], tester);
|
||||
expect(_primaryAnimation[containerOne], equals(1.0));
|
||||
expect(_secondaryAnimation[containerOne], equals(0.6));
|
||||
expect(_primaryAnimation[containerTwo], equals(0.6));
|
||||
expect(_secondaryAnimation[containerTwo], moreOrLessEquals(0.2));
|
||||
expect(_primaryAnimation[containerThree], moreOrLessEquals(0.2));
|
||||
expect(_secondaryAnimation[containerThree], equals(0.0));
|
||||
expect(primaryAnimation[containerOne], equals(1.0));
|
||||
expect(secondaryAnimation[containerOne], equals(0.6));
|
||||
expect(primaryAnimation[containerTwo], equals(0.6));
|
||||
expect(secondaryAnimation[containerTwo], moreOrLessEquals(0.2));
|
||||
expect(primaryAnimation[containerThree], moreOrLessEquals(0.2));
|
||||
expect(secondaryAnimation[containerThree], equals(0.0));
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
@ -80,39 +80,39 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Container(key: containerOne, color: const Color(0x00000000)),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
reverse: true,
|
||||
child: Container(key: containerOne, color: const Color(0x00000000)),
|
||||
),
|
||||
);
|
||||
|
||||
Map<Key, double> _primaryAnimation =
|
||||
Map<Key, double> primaryAnimation =
|
||||
_getPrimaryAnimation(<Key>[containerOne], tester);
|
||||
Map<Key, double> _secondaryAnimation =
|
||||
Map<Key, double> secondaryAnimation =
|
||||
_getSecondaryAnimation(<Key>[containerOne], tester);
|
||||
expect(_primaryAnimation[containerOne], equals(1.0));
|
||||
expect(_secondaryAnimation[containerOne], equals(0.0));
|
||||
expect(primaryAnimation[containerOne], equals(1.0));
|
||||
expect(secondaryAnimation[containerOne], equals(0.0));
|
||||
|
||||
await tester.pumpWidget(
|
||||
PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Container(key: containerTwo, color: const Color(0xff000000)),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
reverse: true,
|
||||
child: Container(key: containerTwo, color: const Color(0xff000000)),
|
||||
),
|
||||
);
|
||||
await tester.pump(const Duration(milliseconds: 40));
|
||||
|
||||
_primaryAnimation =
|
||||
primaryAnimation =
|
||||
_getPrimaryAnimation(<Key>[containerOne, containerTwo], tester);
|
||||
_secondaryAnimation =
|
||||
secondaryAnimation =
|
||||
_getSecondaryAnimation(<Key>[containerOne, containerTwo], tester);
|
||||
// Primary is running forward for outgoing widget.
|
||||
expect(_primaryAnimation[containerOne], moreOrLessEquals(0.6));
|
||||
expect(_secondaryAnimation[containerOne], equals(0.0));
|
||||
expect(primaryAnimation[containerOne], moreOrLessEquals(0.6));
|
||||
expect(secondaryAnimation[containerOne], equals(0.0));
|
||||
// Secondary is running forward for incoming widget.
|
||||
expect(_primaryAnimation[containerTwo], equals(1.0));
|
||||
expect(_secondaryAnimation[containerTwo], moreOrLessEquals(0.6));
|
||||
expect(primaryAnimation[containerTwo], equals(1.0));
|
||||
expect(secondaryAnimation[containerTwo], moreOrLessEquals(0.6));
|
||||
|
||||
// Container two two is underneath container one.
|
||||
final Container container = tester.firstWidget(find.byType(Container));
|
||||
@ -121,23 +121,23 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Container(key: containerThree, color: const Color(0xffff0000)),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
reverse: true,
|
||||
child: Container(key: containerThree, color: const Color(0xffff0000)),
|
||||
),
|
||||
);
|
||||
await tester.pump(const Duration(milliseconds: 20));
|
||||
|
||||
_primaryAnimation = _getPrimaryAnimation(
|
||||
primaryAnimation = _getPrimaryAnimation(
|
||||
<Key>[containerOne, containerTwo, containerThree], tester);
|
||||
_secondaryAnimation = _getSecondaryAnimation(
|
||||
secondaryAnimation = _getSecondaryAnimation(
|
||||
<Key>[containerOne, containerTwo, containerThree], tester);
|
||||
expect(_primaryAnimation[containerOne], equals(0.4));
|
||||
expect(_secondaryAnimation[containerOne], equals(0.0));
|
||||
expect(_primaryAnimation[containerTwo], equals(0.8));
|
||||
expect(_secondaryAnimation[containerTwo], equals(0.4));
|
||||
expect(_primaryAnimation[containerThree], equals(1.0));
|
||||
expect(_secondaryAnimation[containerThree], equals(0.8));
|
||||
expect(primaryAnimation[containerOne], equals(0.4));
|
||||
expect(secondaryAnimation[containerOne], equals(0.0));
|
||||
expect(primaryAnimation[containerTwo], equals(0.8));
|
||||
expect(secondaryAnimation[containerTwo], equals(0.4));
|
||||
expect(primaryAnimation[containerThree], equals(1.0));
|
||||
expect(secondaryAnimation[containerThree], equals(0.8));
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
@ -148,56 +148,56 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Container(key: containerOne, color: const Color(0x00000000)),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
child: Container(key: containerOne, color: const Color(0x00000000)),
|
||||
),
|
||||
);
|
||||
|
||||
Map<Key, double> _primaryAnimation =
|
||||
Map<Key, double> primaryAnimation =
|
||||
_getPrimaryAnimation(<Key>[containerOne], tester);
|
||||
Map<Key, double> _secondaryAnimation =
|
||||
Map<Key, double> secondaryAnimation =
|
||||
_getSecondaryAnimation(<Key>[containerOne], tester);
|
||||
expect(_primaryAnimation[containerOne], equals(1.0));
|
||||
expect(_secondaryAnimation[containerOne], equals(0.0));
|
||||
expect(primaryAnimation[containerOne], equals(1.0));
|
||||
expect(secondaryAnimation[containerOne], equals(0.0));
|
||||
|
||||
await tester.pumpWidget(
|
||||
PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Container(key: containerTwo, color: const Color(0xff000000)),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
child: Container(key: containerTwo, color: const Color(0xff000000)),
|
||||
),
|
||||
);
|
||||
await tester.pump(const Duration(milliseconds: 40));
|
||||
|
||||
_primaryAnimation =
|
||||
primaryAnimation =
|
||||
_getPrimaryAnimation(<Key>[containerOne, containerTwo], tester);
|
||||
_secondaryAnimation =
|
||||
secondaryAnimation =
|
||||
_getSecondaryAnimation(<Key>[containerOne, containerTwo], tester);
|
||||
expect(_secondaryAnimation[containerOne], moreOrLessEquals(0.4));
|
||||
expect(_primaryAnimation[containerOne], equals(1.0));
|
||||
expect(_secondaryAnimation[containerTwo], equals(0.0));
|
||||
expect(_primaryAnimation[containerTwo], moreOrLessEquals(0.4));
|
||||
expect(secondaryAnimation[containerOne], moreOrLessEquals(0.4));
|
||||
expect(primaryAnimation[containerOne], equals(1.0));
|
||||
expect(secondaryAnimation[containerTwo], equals(0.0));
|
||||
expect(primaryAnimation[containerTwo], moreOrLessEquals(0.4));
|
||||
|
||||
await tester.pumpWidget(
|
||||
PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Container(key: containerThree, color: const Color(0xffff0000)),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
reverse: true,
|
||||
child: Container(key: containerThree, color: const Color(0xffff0000)),
|
||||
),
|
||||
);
|
||||
await tester.pump(const Duration(milliseconds: 20));
|
||||
|
||||
_primaryAnimation = _getPrimaryAnimation(
|
||||
primaryAnimation = _getPrimaryAnimation(
|
||||
<Key>[containerOne, containerTwo, containerThree], tester);
|
||||
_secondaryAnimation = _getSecondaryAnimation(
|
||||
secondaryAnimation = _getSecondaryAnimation(
|
||||
<Key>[containerOne, containerTwo, containerThree], tester);
|
||||
expect(_secondaryAnimation[containerOne], equals(0.6));
|
||||
expect(_primaryAnimation[containerOne], equals(1.0));
|
||||
expect(_secondaryAnimation[containerTwo], equals(0.0));
|
||||
expect(_primaryAnimation[containerTwo], moreOrLessEquals(0.2));
|
||||
expect(_secondaryAnimation[containerThree], equals(0.8));
|
||||
expect(_primaryAnimation[containerThree], equals(1.0));
|
||||
expect(secondaryAnimation[containerOne], equals(0.6));
|
||||
expect(primaryAnimation[containerOne], equals(1.0));
|
||||
expect(secondaryAnimation[containerTwo], equals(0.0));
|
||||
expect(primaryAnimation[containerTwo], moreOrLessEquals(0.2));
|
||||
expect(secondaryAnimation[containerThree], equals(0.8));
|
||||
expect(primaryAnimation[containerThree], equals(1.0));
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
@ -208,39 +208,39 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Container(key: containerOne, color: const Color(0x00000000)),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
reverse: true,
|
||||
child: Container(key: containerOne, color: const Color(0x00000000)),
|
||||
),
|
||||
);
|
||||
|
||||
Map<Key, double> _primaryAnimation =
|
||||
Map<Key, double> primaryAnimation =
|
||||
_getPrimaryAnimation(<Key>[containerOne], tester);
|
||||
Map<Key, double> _secondaryAnimation =
|
||||
Map<Key, double> secondaryAnimation =
|
||||
_getSecondaryAnimation(<Key>[containerOne], tester);
|
||||
expect(_primaryAnimation[containerOne], equals(1.0));
|
||||
expect(_secondaryAnimation[containerOne], equals(0.0));
|
||||
expect(primaryAnimation[containerOne], equals(1.0));
|
||||
expect(secondaryAnimation[containerOne], equals(0.0));
|
||||
|
||||
await tester.pumpWidget(
|
||||
PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Container(key: containerTwo, color: const Color(0xff000000)),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
reverse: true,
|
||||
child: Container(key: containerTwo, color: const Color(0xff000000)),
|
||||
),
|
||||
);
|
||||
await tester.pump(const Duration(milliseconds: 40));
|
||||
|
||||
_primaryAnimation =
|
||||
primaryAnimation =
|
||||
_getPrimaryAnimation(<Key>[containerOne, containerTwo], tester);
|
||||
_secondaryAnimation =
|
||||
secondaryAnimation =
|
||||
_getSecondaryAnimation(<Key>[containerOne, containerTwo], tester);
|
||||
// Primary is running in reverse for outgoing widget.
|
||||
expect(_primaryAnimation[containerOne], moreOrLessEquals(0.6));
|
||||
expect(_secondaryAnimation[containerOne], equals(0.0));
|
||||
expect(primaryAnimation[containerOne], moreOrLessEquals(0.6));
|
||||
expect(secondaryAnimation[containerOne], equals(0.0));
|
||||
// Secondary is running in reverse for incoming widget.
|
||||
expect(_primaryAnimation[containerTwo], equals(1.0));
|
||||
expect(_secondaryAnimation[containerTwo], moreOrLessEquals(0.6));
|
||||
expect(primaryAnimation[containerTwo], equals(1.0));
|
||||
expect(secondaryAnimation[containerTwo], moreOrLessEquals(0.6));
|
||||
|
||||
// Container two is underneath container one.
|
||||
final Container container = tester.firstWidget(find.byType(Container));
|
||||
@ -249,9 +249,8 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Container(key: containerThree, color: const Color(0xffff0000)),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
reverse: false,
|
||||
child: Container(key: containerThree, color: const Color(0xffff0000)),
|
||||
),
|
||||
);
|
||||
await tester.pump(const Duration(milliseconds: 20));
|
||||
@ -262,16 +261,16 @@ void main() {
|
||||
// it should now be exiting underneath container three. Container three's
|
||||
// primary animation should be running forwards since it is entering above
|
||||
// container two.
|
||||
_primaryAnimation = _getPrimaryAnimation(
|
||||
primaryAnimation = _getPrimaryAnimation(
|
||||
<Key>[containerOne, containerTwo, containerThree], tester);
|
||||
_secondaryAnimation = _getSecondaryAnimation(
|
||||
secondaryAnimation = _getSecondaryAnimation(
|
||||
<Key>[containerOne, containerTwo, containerThree], tester);
|
||||
expect(_primaryAnimation[containerOne], equals(0.4));
|
||||
expect(_secondaryAnimation[containerOne], equals(0.0));
|
||||
expect(_primaryAnimation[containerTwo], equals(1.0));
|
||||
expect(_secondaryAnimation[containerTwo], equals(0.8));
|
||||
expect(_primaryAnimation[containerThree], moreOrLessEquals(0.2));
|
||||
expect(_secondaryAnimation[containerThree], equals(0.0));
|
||||
expect(primaryAnimation[containerOne], equals(0.4));
|
||||
expect(secondaryAnimation[containerOne], equals(0.0));
|
||||
expect(primaryAnimation[containerTwo], equals(1.0));
|
||||
expect(secondaryAnimation[containerTwo], equals(0.8));
|
||||
expect(primaryAnimation[containerThree], moreOrLessEquals(0.2));
|
||||
expect(secondaryAnimation[containerThree], equals(0.0));
|
||||
await tester.pumpAndSettle();
|
||||
});
|
||||
|
||||
@ -285,9 +284,9 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Container(color: const Color(0x00000000)),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
layoutBuilder: newLayoutBuilder,
|
||||
child: Container(color: const Color(0x00000000)),
|
||||
),
|
||||
);
|
||||
|
||||
@ -299,8 +298,8 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Container(color: const Color(0x00000000)),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
child: Container(color: const Color(0x00000000)),
|
||||
),
|
||||
);
|
||||
|
||||
@ -314,8 +313,8 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Container(color: const Color(0xff000000)),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
child: Container(color: const Color(0xff000000)),
|
||||
),
|
||||
);
|
||||
|
||||
@ -333,7 +332,6 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
const PageTransitionSwitcher(
|
||||
duration: Duration(milliseconds: 100),
|
||||
child: null,
|
||||
transitionBuilder: _transitionBuilder,
|
||||
),
|
||||
);
|
||||
@ -344,8 +342,8 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Container(color: const Color(0xff000000)),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
child: Container(color: const Color(0xff000000)),
|
||||
),
|
||||
);
|
||||
|
||||
@ -361,7 +359,6 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
const PageTransitionSwitcher(
|
||||
duration: Duration(milliseconds: 100),
|
||||
child: null,
|
||||
transitionBuilder: _transitionBuilder,
|
||||
),
|
||||
);
|
||||
@ -381,16 +378,16 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Container(key: UniqueKey(), color: const Color(0xff000000)),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
child: Container(key: UniqueKey(), color: const Color(0xff000000)),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Container(key: UniqueKey(), color: const Color(0xff000000)),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
child: Container(key: UniqueKey(), color: const Color(0xff000000)),
|
||||
),
|
||||
);
|
||||
await tester.pump(const Duration(milliseconds: 50));
|
||||
@ -405,8 +402,7 @@ void main() {
|
||||
|
||||
// Change the widget tree in the middle of the animation.
|
||||
await tester.pumpWidget(Container(color: const Color(0xffff0000)));
|
||||
expect(await tester.pumpAndSettle(const Duration(milliseconds: 100)),
|
||||
equals(1));
|
||||
expect(await tester.pumpAndSettle(), equals(1));
|
||||
});
|
||||
|
||||
testWidgets("doesn't reset state of the children in transitions.",
|
||||
@ -420,42 +416,42 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: StatefulTestWidget(key: statefulOne),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
child: StatefulTestWidget(key: statefulOne),
|
||||
),
|
||||
);
|
||||
|
||||
Map<Key, double> _primaryAnimation =
|
||||
Map<Key, double> primaryAnimation =
|
||||
_getPrimaryAnimation(<Key>[statefulOne], tester);
|
||||
Map<Key, double> _secondaryAnimation =
|
||||
Map<Key, double> secondaryAnimation =
|
||||
_getSecondaryAnimation(<Key>[statefulOne], tester);
|
||||
expect(_primaryAnimation[statefulOne], equals(1.0));
|
||||
expect(_secondaryAnimation[statefulOne], equals(0.0));
|
||||
expect(primaryAnimation[statefulOne], equals(1.0));
|
||||
expect(secondaryAnimation[statefulOne], equals(0.0));
|
||||
expect(StatefulTestWidgetState.generation, equals(1));
|
||||
|
||||
await tester.pumpWidget(
|
||||
PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: StatefulTestWidget(key: statefulTwo),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
child: StatefulTestWidget(key: statefulTwo),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.pump(const Duration(milliseconds: 50));
|
||||
expect(find.byType(FadeTransition), findsNWidgets(2));
|
||||
_primaryAnimation =
|
||||
primaryAnimation =
|
||||
_getPrimaryAnimation(<Key>[statefulOne, statefulTwo], tester);
|
||||
_secondaryAnimation =
|
||||
secondaryAnimation =
|
||||
_getSecondaryAnimation(<Key>[statefulOne, statefulTwo], tester);
|
||||
expect(_primaryAnimation[statefulTwo], equals(0.5));
|
||||
expect(_secondaryAnimation[statefulTwo], equals(0.0));
|
||||
expect(primaryAnimation[statefulTwo], equals(0.5));
|
||||
expect(secondaryAnimation[statefulTwo], equals(0.0));
|
||||
expect(StatefulTestWidgetState.generation, equals(2));
|
||||
|
||||
await tester.pumpWidget(
|
||||
PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: StatefulTestWidget(key: statefulThree),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
child: StatefulTestWidget(key: statefulThree),
|
||||
),
|
||||
);
|
||||
|
||||
@ -473,8 +469,8 @@ void main() {
|
||||
textDirection: TextDirection.rtl,
|
||||
child: PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: child,
|
||||
transitionBuilder: _transitionBuilder,
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
);
|
||||
@ -511,8 +507,8 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
child: PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
child: Container(key: containerOne, color: const Color(0xFFFF0000)),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
),
|
||||
),
|
||||
);
|
||||
@ -524,8 +520,8 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
child: PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
child: Container(key: containerTwo, color: const Color(0xFF00FF00)),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
),
|
||||
),
|
||||
);
|
||||
@ -537,8 +533,8 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
child: PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Container(key: containerThree, color: const Color(0xFF0000FF)),
|
||||
transitionBuilder: _transitionBuilder,
|
||||
child: Container(key: containerThree, color: const Color(0xFF0000FF)),
|
||||
),
|
||||
),
|
||||
);
|
||||
@ -569,8 +565,8 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
child: PageTransitionSwitcher(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Container(key: containerThree, color: const Color(0x00000000)),
|
||||
transitionBuilder: newTransitionBuilder,
|
||||
child: Container(key: containerThree, color: const Color(0x00000000)),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -596,9 +596,9 @@ void main() {
|
||||
child: Center(
|
||||
child: SharedAxisTransition(
|
||||
transitionType: SharedAxisTransitionType.horizontal,
|
||||
child: const _StatefulTestWidget(name: 'Foo'),
|
||||
animation: animation,
|
||||
secondaryAnimation: secondaryAnimation,
|
||||
child: const _StatefulTestWidget(name: 'Foo'),
|
||||
),
|
||||
),
|
||||
));
|
||||
@ -1239,9 +1239,9 @@ void main() {
|
||||
child: Center(
|
||||
child: SharedAxisTransition(
|
||||
transitionType: SharedAxisTransitionType.vertical,
|
||||
child: const _StatefulTestWidget(name: 'Foo'),
|
||||
animation: animation,
|
||||
secondaryAnimation: secondaryAnimation,
|
||||
child: const _StatefulTestWidget(name: 'Foo'),
|
||||
),
|
||||
),
|
||||
));
|
||||
@ -1775,9 +1775,9 @@ void main() {
|
||||
child: Center(
|
||||
child: SharedAxisTransition(
|
||||
transitionType: SharedAxisTransitionType.scaled,
|
||||
child: const _StatefulTestWidget(name: 'Foo'),
|
||||
animation: animation,
|
||||
secondaryAnimation: secondaryAnimation,
|
||||
child: const _StatefulTestWidget(name: 'Foo'),
|
||||
),
|
||||
),
|
||||
));
|
||||
|
@ -1,3 +1,7 @@
|
||||
## NEXT
|
||||
|
||||
* Fixes lint warnings in tests.
|
||||
|
||||
## 0.3.3+1
|
||||
|
||||
* Fixes `lastModified` unimplemented error description.
|
||||
|
@ -13,7 +13,7 @@ import 'package:test/test.dart';
|
||||
|
||||
final String pathPrefix =
|
||||
Directory.current.path.endsWith('test') ? './assets/' : './test/assets/';
|
||||
final String path = pathPrefix + 'hello.txt';
|
||||
final String path = '${pathPrefix}hello.txt';
|
||||
const String expectedStringContents = 'Hello, world!';
|
||||
final Uint8List bytes = Uint8List.fromList(utf8.encode(expectedStringContents));
|
||||
final File textFile = File(path);
|
||||
|
@ -29,9 +29,9 @@ class DynamicGridView extends GridView {
|
||||
super.key,
|
||||
required super.gridDelegate,
|
||||
// This creates a SliverChildBuilderDelegate in the super class.
|
||||
required IndexedWidgetBuilder itemBuilder,
|
||||
required super.itemBuilder,
|
||||
super.itemCount,
|
||||
}) : super.builder(itemBuilder: itemBuilder);
|
||||
}) : super.builder();
|
||||
|
||||
// TODO(snat-s): DynamicGridView.wrap?
|
||||
|
||||
|
@ -16,7 +16,6 @@ void main() {
|
||||
home: Scaffold(
|
||||
body: DynamicGridView(
|
||||
gridDelegate: TestDelegate(crossAxisCount: 2),
|
||||
children: const <Widget>[],
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -41,7 +40,7 @@ void main() {
|
||||
|
||||
// Only the visible tiles have ben laid out.
|
||||
expect(find.text('Index 0'), findsOneWidget);
|
||||
expect(tester.getTopLeft(find.text('Index 0')), const Offset(0.0, 0.0));
|
||||
expect(tester.getTopLeft(find.text('Index 0')), Offset.zero);
|
||||
expect(find.text('Index 1'), findsOneWidget);
|
||||
expect(tester.getTopLeft(find.text('Index 1')), const Offset(50.0, 0.0));
|
||||
expect(find.text('Index 2'), findsOneWidget);
|
||||
@ -72,7 +71,7 @@ void main() {
|
||||
|
||||
// Only the visible tiles have ben laid out, up to itemCount.
|
||||
expect(find.text('Index 0'), findsOneWidget);
|
||||
expect(tester.getTopLeft(find.text('Index 0')), const Offset(0.0, 0.0));
|
||||
expect(tester.getTopLeft(find.text('Index 0')), Offset.zero);
|
||||
expect(find.text('Index 1'), findsOneWidget);
|
||||
expect(tester.getTopLeft(find.text('Index 1')), const Offset(50.0, 0.0));
|
||||
expect(find.text('Index 2'), findsOneWidget);
|
||||
@ -100,7 +99,7 @@ void main() {
|
||||
|
||||
// Only the visible tiles have ben laid out.
|
||||
expect(find.text('Index 0'), findsOneWidget);
|
||||
expect(tester.getTopLeft(find.text('Index 0')), const Offset(0.0, 0.0));
|
||||
expect(tester.getTopLeft(find.text('Index 0')), Offset.zero);
|
||||
expect(find.text('Index 1'), findsOneWidget);
|
||||
expect(tester.getTopLeft(find.text('Index 1')), const Offset(50.0, 0.0));
|
||||
expect(find.text('Index 2'), findsOneWidget);
|
||||
|
@ -1,3 +1,7 @@
|
||||
## 2.0.7
|
||||
|
||||
* Fixes lint warnings.
|
||||
|
||||
## 2.0.6
|
||||
|
||||
* Drops support for Flutter <2.8.
|
||||
|
@ -100,7 +100,7 @@ class SignInDemoState extends State<SignInDemo> {
|
||||
try {
|
||||
await _googleSignIn.signIn();
|
||||
} catch (error) {
|
||||
print(error);
|
||||
print(error); // ignore: avoid_print
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,12 +122,12 @@ class SignInDemoState extends State<SignInDemo> {
|
||||
const Text('Signed in successfully.'),
|
||||
Text(_contactText),
|
||||
ElevatedButton(
|
||||
child: const Text('SIGN OUT'),
|
||||
onPressed: _handleSignOut,
|
||||
child: const Text('SIGN OUT'),
|
||||
),
|
||||
ElevatedButton(
|
||||
child: const Text('REFRESH'),
|
||||
onPressed: _handleGetContact,
|
||||
child: const Text('REFRESH'),
|
||||
),
|
||||
],
|
||||
);
|
||||
@ -137,8 +137,8 @@ class SignInDemoState extends State<SignInDemo> {
|
||||
children: <Widget>[
|
||||
const Text('You are not currently signed in.'),
|
||||
ElevatedButton(
|
||||
child: const Text('SIGN IN'),
|
||||
onPressed: _handleSignIn,
|
||||
child: const Text('SIGN IN'),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
@ -8,7 +8,7 @@ name: extension_google_sign_in_as_googleapis_auth
|
||||
description: A bridge package between google_sign_in and googleapis_auth, to create Authenticated Clients from google_sign_in user credentials.
|
||||
repository: https://github.com/flutter/packages/tree/main/packages/extension_google_sign_in_as_googleapis_auth
|
||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+extension_google_sign_in_as_googleapis_auth%22
|
||||
version: 2.0.6
|
||||
version: 2.0.7
|
||||
|
||||
environment:
|
||||
sdk: ">=2.12.0 <3.0.0"
|
||||
|
@ -1,8 +1,9 @@
|
||||
## NEXT
|
||||
## 4.1.4
|
||||
|
||||
* Ignores lint warnings from new changes in Flutter master.
|
||||
* Suppresses more deprecation warnings for changes to Flutter master.
|
||||
* Removes duplicate test from test script.
|
||||
* Fixes lint warnings.
|
||||
|
||||
## 4.1.3
|
||||
|
||||
|
@ -227,8 +227,9 @@ class NetworkImageWithRetry extends ImageProvider<NetworkImageWithRetry> {
|
||||
if (other.runtimeType != runtimeType) {
|
||||
return false;
|
||||
}
|
||||
final NetworkImageWithRetry typedOther = other;
|
||||
return url == typedOther.url && scale == typedOther.scale;
|
||||
return other is NetworkImageWithRetry &&
|
||||
url == other.url &&
|
||||
scale == other.scale;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -3,7 +3,7 @@ description: >
|
||||
Image utilities for Flutter: improved network providers, effects, etc.
|
||||
repository: https://github.com/flutter/packages/tree/main/packages/flutter_image
|
||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_image%22
|
||||
version: 4.1.3
|
||||
version: 4.1.4
|
||||
|
||||
environment:
|
||||
sdk: ">=2.12.0 <3.0.0"
|
||||
|
@ -85,7 +85,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('retries 6 times then gives up', () async {
|
||||
final dynamic maxAttemptCountReached = expectAsync0(() {});
|
||||
final VoidCallback maxAttemptCountReached = expectAsync0(() {});
|
||||
|
||||
int attemptCount = 0;
|
||||
Future<void> onAttempt() async {
|
||||
|
@ -1,3 +1,7 @@
|
||||
## 0.6.10+5
|
||||
|
||||
* Fixes lint warnings.
|
||||
|
||||
## 0.6.10+4
|
||||
|
||||
* Updates text theme parameters to avoid deprecation issues.
|
||||
|
@ -43,6 +43,8 @@ Since GitHub Flavored is the default extension set, it is the initial setting
|
||||
for the formatted Markdown view in the demo.
|
||||
""";
|
||||
|
||||
// TODO(goderbauer): Restructure the examples to avoid this ignore, https://github.com/flutter/flutter/issues/110208.
|
||||
// ignore: avoid_implementing_value_types
|
||||
class BasicMarkdownDemo extends StatefulWidget implements MarkdownDemoWidget {
|
||||
const BasicMarkdownDemo({Key? key}) : super(key: key);
|
||||
|
||||
@ -63,7 +65,7 @@ class BasicMarkdownDemo extends StatefulWidget implements MarkdownDemoWidget {
|
||||
Future<String> get notes => Future<String>.value(_notes);
|
||||
|
||||
@override
|
||||
_BasicMarkdownDemoState createState() => _BasicMarkdownDemoState();
|
||||
State<BasicMarkdownDemo> createState() => _BasicMarkdownDemoState();
|
||||
}
|
||||
|
||||
class _BasicMarkdownDemoState extends State<BasicMarkdownDemo> {
|
||||
|
@ -25,6 +25,8 @@ This example demonstrates how to implement a centered headline using a custom bu
|
||||
|
||||
''';
|
||||
|
||||
// TODO(goderbauer): Restructure the examples to avoid this ignore, https://github.com/flutter/flutter/issues/110208.
|
||||
// ignore: avoid_implementing_value_types
|
||||
class CenteredHeaderDemo extends StatelessWidget implements MarkdownDemoWidget {
|
||||
const CenteredHeaderDemo({Key? key}) : super(key: key);
|
||||
|
||||
|
@ -46,6 +46,8 @@ class ExtendedEmojiSyntax extends md.EmojiSyntax {
|
||||
```
|
||||
""";
|
||||
|
||||
// TODO(goderbauer): Restructure the examples to avoid this ignore, https://github.com/flutter/flutter/issues/110208.
|
||||
// ignore: avoid_implementing_value_types
|
||||
class ExtendedEmojiDemo extends StatelessWidget implements MarkdownDemoWidget {
|
||||
const ExtendedEmojiDemo({Key? key}) : super(key: key);
|
||||
|
||||
|
@ -2,6 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// TODO(goderbauer): Restructure the examples to avoid this ignore, https://github.com/flutter/flutter/issues/110208.
|
||||
// ignore_for_file: avoid_implementing_value_types
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import '../shared/dropdown_menu.dart';
|
||||
|
@ -2,6 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// TODO(goderbauer): Restructure the examples to avoid this ignore, https://github.com/flutter/flutter/issues/110208.
|
||||
// ignore_for_file: avoid_implementing_value_types
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import '../shared/markdown_demo_widget.dart';
|
||||
|
@ -2,6 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// TODO(goderbauer): Restructure the examples to avoid this ignore, https://github.com/flutter/flutter/issues/110208.
|
||||
// ignore_for_file: avoid_implementing_value_types
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import '../shared/markdown_demo_widget.dart';
|
||||
|
@ -2,6 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// TODO(goderbauer): Restructure the examples to avoid this ignore, https://github.com/flutter/flutter/issues/110208.
|
||||
// ignore_for_file: avoid_implementing_value_types
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import 'package:markdown/markdown.dart' as md;
|
||||
|
@ -28,6 +28,8 @@ spacing parameter. The Markdown widget lays out block elements in a column using
|
||||
spacing parameter sets the height of the **SizedBox**.
|
||||
''';
|
||||
|
||||
// TODO(goderbauer): Restructure the examples to avoid this ignore, https://github.com/flutter/flutter/issues/110208.
|
||||
// ignore: avoid_implementing_value_types
|
||||
class WrapAlignmentDemo extends StatefulWidget implements MarkdownDemoWidget {
|
||||
const WrapAlignmentDemo({Key? key}) : super(key: key);
|
||||
|
||||
@ -48,7 +50,7 @@ class WrapAlignmentDemo extends StatefulWidget implements MarkdownDemoWidget {
|
||||
Future<String> get notes => Future<String>.value(_notes);
|
||||
|
||||
@override
|
||||
_WrapAlignmentDemoState createState() => _WrapAlignmentDemoState();
|
||||
State<WrapAlignmentDemo> createState() => _WrapAlignmentDemoState();
|
||||
}
|
||||
|
||||
class _WrapAlignmentDemoState extends State<WrapAlignmentDemo> {
|
||||
|
@ -65,11 +65,11 @@ class DropdownMenu<T> extends StatelessWidget {
|
||||
items: <DropdownMenuItem<T>>[
|
||||
for (String item in items.keys)
|
||||
DropdownMenuItem<T>(
|
||||
value: items[item],
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(left: 4),
|
||||
child: Text(item),
|
||||
),
|
||||
value: items[item],
|
||||
),
|
||||
],
|
||||
onChanged: (T? value) => onChanged!(value),
|
||||
|
@ -9,10 +9,11 @@ environment:
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
dev_dependencies:
|
||||
flutter_markdown:
|
||||
path: ../
|
||||
markdown: 5.0.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
|
@ -60,6 +60,7 @@ final MarkdownStyleSheet Function(BuildContext, MarkdownStyleSheetBaseTheme?)
|
||||
MarkdownStyleSheet.fromCupertinoTheme(CupertinoTheme.of(context));
|
||||
break;
|
||||
case MarkdownStyleSheetBaseTheme.material:
|
||||
// ignore: no_default_cases
|
||||
default:
|
||||
result = MarkdownStyleSheet.fromTheme(Theme.of(context));
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ final MarkdownStyleSheet Function(BuildContext, MarkdownStyleSheetBaseTheme?)
|
||||
MarkdownStyleSheet.fromCupertinoTheme(CupertinoTheme.of(context));
|
||||
break;
|
||||
case MarkdownStyleSheetBaseTheme.material:
|
||||
default:
|
||||
default: // ignore: no_default_cases
|
||||
result = MarkdownStyleSheet.fromTheme(Theme.of(context));
|
||||
}
|
||||
|
||||
|
@ -209,8 +209,9 @@ class MarkdownBuilder implements md.NodeVisitor {
|
||||
_addAnonymousBlockIfNeeded();
|
||||
if (_isListTag(tag)) {
|
||||
_listIndents.add(tag);
|
||||
if (element.attributes['start'] != null)
|
||||
if (element.attributes['start'] != null) {
|
||||
start = int.parse(element.attributes['start']!) - 1;
|
||||
}
|
||||
} else if (tag == 'blockquote') {
|
||||
_isInBlockquote = true;
|
||||
} else if (tag == 'table') {
|
||||
@ -278,7 +279,7 @@ class MarkdownBuilder implements md.NodeVisitor {
|
||||
? element.children!
|
||||
.map((md.Node e) =>
|
||||
e is md.Text ? e.text : extractTextFromElement(e))
|
||||
.join('')
|
||||
.join()
|
||||
: (element is md.Element && (element.attributes.isNotEmpty)
|
||||
? element.attributes['alt']
|
||||
: '');
|
||||
@ -298,13 +299,13 @@ class MarkdownBuilder implements md.NodeVisitor {
|
||||
String trimText(String text) {
|
||||
// The leading spaces pattern is used to identify spaces
|
||||
// at the beginning of a line of text.
|
||||
final RegExp _leadingSpacesPattern = RegExp(r'^ *');
|
||||
final RegExp leadingSpacesPattern = RegExp(r'^ *');
|
||||
|
||||
// The soft line break is used to identify the spaces at the end of a line
|
||||
// of text and the leading spaces in the immediately following the line
|
||||
// of text. These spaces are removed in accordance with the Markdown
|
||||
// specification on soft line breaks when lines of text are joined.
|
||||
final RegExp _softLineBreak = RegExp(r' ?\n *');
|
||||
final RegExp softLineBreakPattern = RegExp(r' ?\n *');
|
||||
|
||||
// Leading spaces following a hard line break are ignored.
|
||||
// https://github.github.com/gfm/#example-657
|
||||
@ -312,13 +313,13 @@ class MarkdownBuilder implements md.NodeVisitor {
|
||||
// https://github.github.com/gfm/#example-192
|
||||
// https://github.github.com/gfm/#example-236
|
||||
if (const <String>['ul', 'ol', 'p', 'br'].contains(_lastVisitedTag)) {
|
||||
text = text.replaceAll(_leadingSpacesPattern, '');
|
||||
text = text.replaceAll(leadingSpacesPattern, '');
|
||||
}
|
||||
|
||||
if (softLineBreak) {
|
||||
return text;
|
||||
}
|
||||
return text.replaceAll(_softLineBreak, ' ');
|
||||
return text.replaceAll(softLineBreakPattern, ' ');
|
||||
}
|
||||
|
||||
Widget? child;
|
||||
@ -530,7 +531,7 @@ class MarkdownBuilder implements md.NodeVisitor {
|
||||
if (_linkHandlers.isNotEmpty) {
|
||||
final TapGestureRecognizer recognizer =
|
||||
_linkHandlers.last as TapGestureRecognizer;
|
||||
return GestureDetector(child: child, onTap: recognizer.onTap);
|
||||
return GestureDetector(onTap: recognizer.onTap, child: child);
|
||||
} else {
|
||||
return child;
|
||||
}
|
||||
@ -648,8 +649,8 @@ class MarkdownBuilder implements md.NodeVisitor {
|
||||
);
|
||||
final Wrap wrap = Wrap(
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: mergedInlines,
|
||||
alignment: blockAlignment,
|
||||
children: mergedInlines,
|
||||
);
|
||||
|
||||
if (textPadding == EdgeInsets.zero) {
|
||||
@ -757,9 +758,13 @@ class MarkdownBuilder implements md.NodeVisitor {
|
||||
case 'pre':
|
||||
return styleSheet.codeblockAlign;
|
||||
case 'hr':
|
||||
// TODO(goderbauer): We shouldn't be printing here, https://github.com/flutter/flutter/issues/110209
|
||||
// ignore: avoid_print
|
||||
print('Markdown did not handle hr for alignment');
|
||||
break;
|
||||
case 'li':
|
||||
// TODO(goderbauer): We shouldn't be printing here, https://github.com/flutter/flutter/issues/110209
|
||||
// ignore: avoid_print
|
||||
print('Markdown did not handle li for alignment');
|
||||
break;
|
||||
}
|
||||
|
@ -123,7 +123,6 @@ class MarkdownStyleSheet {
|
||||
tableHeadAlign: TextAlign.center,
|
||||
tableBorder: TableBorder.all(
|
||||
color: theme.dividerColor,
|
||||
width: 1,
|
||||
),
|
||||
tableColumnWidth: const FlexColumnWidth(),
|
||||
tableCellsPadding: const EdgeInsets.fromLTRB(16, 8, 16, 8),
|
||||
@ -253,7 +252,6 @@ class MarkdownStyleSheet {
|
||||
color: theme.brightness == Brightness.dark
|
||||
? CupertinoColors.systemGrey4.darkColor
|
||||
: CupertinoColors.systemGrey4.color,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -660,57 +658,57 @@ class MarkdownStyleSheet {
|
||||
if (other.runtimeType != MarkdownStyleSheet) {
|
||||
return false;
|
||||
}
|
||||
final MarkdownStyleSheet typedOther = other;
|
||||
return typedOther.a == a &&
|
||||
typedOther.p == p &&
|
||||
typedOther.pPadding == pPadding &&
|
||||
typedOther.code == code &&
|
||||
typedOther.h1 == h1 &&
|
||||
typedOther.h1Padding == h1Padding &&
|
||||
typedOther.h2 == h2 &&
|
||||
typedOther.h2Padding == h2Padding &&
|
||||
typedOther.h3 == h3 &&
|
||||
typedOther.h3Padding == h3Padding &&
|
||||
typedOther.h4 == h4 &&
|
||||
typedOther.h4Padding == h4Padding &&
|
||||
typedOther.h5 == h5 &&
|
||||
typedOther.h5Padding == h5Padding &&
|
||||
typedOther.h6 == h6 &&
|
||||
typedOther.h6Padding == h6Padding &&
|
||||
typedOther.em == em &&
|
||||
typedOther.strong == strong &&
|
||||
typedOther.del == del &&
|
||||
typedOther.blockquote == blockquote &&
|
||||
typedOther.img == img &&
|
||||
typedOther.checkbox == checkbox &&
|
||||
typedOther.blockSpacing == blockSpacing &&
|
||||
typedOther.listIndent == listIndent &&
|
||||
typedOther.listBullet == listBullet &&
|
||||
typedOther.listBulletPadding == listBulletPadding &&
|
||||
typedOther.tableHead == tableHead &&
|
||||
typedOther.tableBody == tableBody &&
|
||||
typedOther.tableHeadAlign == tableHeadAlign &&
|
||||
typedOther.tableBorder == tableBorder &&
|
||||
typedOther.tableColumnWidth == tableColumnWidth &&
|
||||
typedOther.tableCellsPadding == tableCellsPadding &&
|
||||
typedOther.tableCellsDecoration == tableCellsDecoration &&
|
||||
typedOther.blockquotePadding == blockquotePadding &&
|
||||
typedOther.blockquoteDecoration == blockquoteDecoration &&
|
||||
typedOther.codeblockPadding == codeblockPadding &&
|
||||
typedOther.codeblockDecoration == codeblockDecoration &&
|
||||
typedOther.horizontalRuleDecoration == horizontalRuleDecoration &&
|
||||
typedOther.textAlign == textAlign &&
|
||||
typedOther.h1Align == h1Align &&
|
||||
typedOther.h2Align == h2Align &&
|
||||
typedOther.h3Align == h3Align &&
|
||||
typedOther.h4Align == h4Align &&
|
||||
typedOther.h5Align == h5Align &&
|
||||
typedOther.h6Align == h6Align &&
|
||||
typedOther.unorderedListAlign == unorderedListAlign &&
|
||||
typedOther.orderedListAlign == orderedListAlign &&
|
||||
typedOther.blockquoteAlign == blockquoteAlign &&
|
||||
typedOther.codeblockAlign == codeblockAlign &&
|
||||
typedOther.textScaleFactor == textScaleFactor;
|
||||
return other is MarkdownStyleSheet &&
|
||||
other.a == a &&
|
||||
other.p == p &&
|
||||
other.pPadding == pPadding &&
|
||||
other.code == code &&
|
||||
other.h1 == h1 &&
|
||||
other.h1Padding == h1Padding &&
|
||||
other.h2 == h2 &&
|
||||
other.h2Padding == h2Padding &&
|
||||
other.h3 == h3 &&
|
||||
other.h3Padding == h3Padding &&
|
||||
other.h4 == h4 &&
|
||||
other.h4Padding == h4Padding &&
|
||||
other.h5 == h5 &&
|
||||
other.h5Padding == h5Padding &&
|
||||
other.h6 == h6 &&
|
||||
other.h6Padding == h6Padding &&
|
||||
other.em == em &&
|
||||
other.strong == strong &&
|
||||
other.del == del &&
|
||||
other.blockquote == blockquote &&
|
||||
other.img == img &&
|
||||
other.checkbox == checkbox &&
|
||||
other.blockSpacing == blockSpacing &&
|
||||
other.listIndent == listIndent &&
|
||||
other.listBullet == listBullet &&
|
||||
other.listBulletPadding == listBulletPadding &&
|
||||
other.tableHead == tableHead &&
|
||||
other.tableBody == tableBody &&
|
||||
other.tableHeadAlign == tableHeadAlign &&
|
||||
other.tableBorder == tableBorder &&
|
||||
other.tableColumnWidth == tableColumnWidth &&
|
||||
other.tableCellsPadding == tableCellsPadding &&
|
||||
other.tableCellsDecoration == tableCellsDecoration &&
|
||||
other.blockquotePadding == blockquotePadding &&
|
||||
other.blockquoteDecoration == blockquoteDecoration &&
|
||||
other.codeblockPadding == codeblockPadding &&
|
||||
other.codeblockDecoration == codeblockDecoration &&
|
||||
other.horizontalRuleDecoration == horizontalRuleDecoration &&
|
||||
other.textAlign == textAlign &&
|
||||
other.h1Align == h1Align &&
|
||||
other.h2Align == h2Align &&
|
||||
other.h3Align == h3Align &&
|
||||
other.h4Align == h4Align &&
|
||||
other.h5Align == h5Align &&
|
||||
other.h6Align == h6Align &&
|
||||
other.unorderedListAlign == unorderedListAlign &&
|
||||
other.orderedListAlign == orderedListAlign &&
|
||||
other.blockquoteAlign == blockquoteAlign &&
|
||||
other.codeblockAlign == codeblockAlign &&
|
||||
other.textScaleFactor == textScaleFactor;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -7,9 +7,9 @@ import 'dart:convert';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import 'package:markdown/markdown.dart' as md;
|
||||
|
||||
import '../flutter_markdown.dart';
|
||||
import '_functions_io.dart' if (dart.library.html) '_functions_web.dart';
|
||||
|
||||
/// Signature for callbacks used by [MarkdownWidget] when the user taps a link.
|
||||
@ -271,7 +271,7 @@ abstract class MarkdownWidget extends StatefulWidget {
|
||||
Widget build(BuildContext context, List<Widget>? children);
|
||||
|
||||
@override
|
||||
_MarkdownWidgetState createState() => _MarkdownWidgetState();
|
||||
State<MarkdownWidget> createState() => _MarkdownWidgetState();
|
||||
}
|
||||
|
||||
class _MarkdownWidgetState extends State<MarkdownWidget>
|
||||
@ -348,9 +348,10 @@ class _MarkdownWidgetState extends State<MarkdownWidget>
|
||||
final List<GestureRecognizer> localRecognizers =
|
||||
List<GestureRecognizer>.from(_recognizers);
|
||||
_recognizers.clear();
|
||||
for (final GestureRecognizer recognizer in localRecognizers)
|
||||
for (final GestureRecognizer recognizer in localRecognizers) {
|
||||
recognizer.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
GestureRecognizer createLink(String text, String? href, String title) {
|
||||
|
@ -4,7 +4,7 @@ description: A Markdown renderer for Flutter. Create rich text output,
|
||||
formatted with simple Markdown tags.
|
||||
repository: https://github.com/flutter/packages/tree/main/packages/flutter_markdown
|
||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_markdown%22
|
||||
version: 0.6.10+4
|
||||
version: 0.6.10+5
|
||||
|
||||
environment:
|
||||
sdk: ">=2.12.0 <3.0.0"
|
||||
|
@ -29,7 +29,7 @@ void defineTests() {
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'doesn\'t convert & to & when parsing',
|
||||
"doesn't convert & to & when parsing",
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
boilerplate(
|
||||
@ -41,7 +41,7 @@ void defineTests() {
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'doesn\'t convert < to < when parsing',
|
||||
"doesn't convert < to < when parsing",
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
boilerplate(
|
||||
@ -53,7 +53,7 @@ void defineTests() {
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'doesn\'t convert existing HTML entities when parsing',
|
||||
"doesn't convert existing HTML entities when parsing",
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
boilerplate(
|
||||
|
@ -21,7 +21,7 @@ MockHttpClient createMockImageHttpClient(SecurityContext? _) {
|
||||
final MockHttpClientResponse response = MockHttpClientResponse();
|
||||
final MockHttpHeaders headers = MockHttpHeaders();
|
||||
|
||||
final List<int> _transparentImage = getTestImageData();
|
||||
final List<int> transparentImage = getTestImageData();
|
||||
|
||||
when(client.getUrl(any))
|
||||
.thenAnswer((_) => Future<MockHttpClientRequest>.value(request));
|
||||
@ -33,7 +33,7 @@ MockHttpClient createMockImageHttpClient(SecurityContext? _) {
|
||||
|
||||
when(client.autoUncompress = any).thenAnswer((_) => null);
|
||||
|
||||
when(response.contentLength).thenReturn(_transparentImage.length);
|
||||
when(response.contentLength).thenReturn(transparentImage.length);
|
||||
|
||||
when(response.statusCode).thenReturn(HttpStatus.ok);
|
||||
|
||||
@ -49,8 +49,7 @@ MockHttpClient createMockImageHttpClient(SecurityContext? _) {
|
||||
invocation.namedArguments[#onError];
|
||||
final bool? cancelOnError = invocation.namedArguments[#cancelOnError];
|
||||
|
||||
return Stream<List<int>>.fromIterable(<List<int>>[_transparentImage])
|
||||
.listen(
|
||||
return Stream<List<int>>.fromIterable(<List<int>>[transparentImage]).listen(
|
||||
onData,
|
||||
onError: onError,
|
||||
onDone: onDone,
|
||||
@ -94,6 +93,7 @@ List<int> getTestImageData() {
|
||||
/// Define the "fake" data types to be used in mock data type definitions. These
|
||||
/// fake data types are important in the definition of the return values of the
|
||||
/// properties and methods of the mock data types for null safety.
|
||||
// ignore: avoid_implementing_value_types
|
||||
class _FakeDuration extends Fake implements Duration {}
|
||||
|
||||
class _FakeHttpClientRequest extends Fake implements HttpClientRequest {}
|
||||
@ -123,8 +123,8 @@ class MockHttpClient extends Mock implements HttpClient {
|
||||
returnValue: _FakeDuration()) as Duration;
|
||||
|
||||
@override
|
||||
set idleTimeout(Duration? _idleTimeout) =>
|
||||
super.noSuchMethod(Invocation.setter(#idleTimeout, _idleTimeout));
|
||||
set idleTimeout(Duration? idleTimeout) =>
|
||||
super.noSuchMethod(Invocation.setter(#idleTimeout, idleTimeout));
|
||||
|
||||
@override
|
||||
bool get autoUncompress =>
|
||||
@ -132,8 +132,8 @@ class MockHttpClient extends Mock implements HttpClient {
|
||||
as bool;
|
||||
|
||||
@override
|
||||
set autoUncompress(bool? _autoUncompress) =>
|
||||
super.noSuchMethod(Invocation.setter(#autoUncompress, _autoUncompress));
|
||||
set autoUncompress(bool? autoUncompress) =>
|
||||
super.noSuchMethod(Invocation.setter(#autoUncompress, autoUncompress));
|
||||
|
||||
@override
|
||||
Future<HttpClientRequest> open(
|
||||
@ -259,8 +259,8 @@ class MockHttpClientRequest extends Mock implements HttpClientRequest {
|
||||
returnValue: false) as bool;
|
||||
|
||||
@override
|
||||
set persistentConnection(bool? _persistentConnection) => super.noSuchMethod(
|
||||
Invocation.setter(#persistentConnection, _persistentConnection));
|
||||
set persistentConnection(bool? persistentConnection) => super.noSuchMethod(
|
||||
Invocation.setter(#persistentConnection, persistentConnection));
|
||||
|
||||
@override
|
||||
bool get followRedirects => super
|
||||
@ -268,8 +268,8 @@ class MockHttpClientRequest extends Mock implements HttpClientRequest {
|
||||
as bool;
|
||||
|
||||
@override
|
||||
set followRedirects(bool? _followRedirects) =>
|
||||
super.noSuchMethod(Invocation.setter(#followRedirects, _followRedirects));
|
||||
set followRedirects(bool? followRedirects) =>
|
||||
super.noSuchMethod(Invocation.setter(#followRedirects, followRedirects));
|
||||
|
||||
@override
|
||||
int get maxRedirects =>
|
||||
@ -277,8 +277,8 @@ class MockHttpClientRequest extends Mock implements HttpClientRequest {
|
||||
as int;
|
||||
|
||||
@override
|
||||
set maxRedirects(int? _maxRedirects) =>
|
||||
super.noSuchMethod(Invocation.setter(#maxRedirects, _maxRedirects));
|
||||
set maxRedirects(int? maxRedirects) =>
|
||||
super.noSuchMethod(Invocation.setter(#maxRedirects, maxRedirects));
|
||||
|
||||
@override
|
||||
int get contentLength =>
|
||||
@ -286,8 +286,8 @@ class MockHttpClientRequest extends Mock implements HttpClientRequest {
|
||||
as int;
|
||||
|
||||
@override
|
||||
set contentLength(int? _contentLength) =>
|
||||
super.noSuchMethod(Invocation.setter(#contentLength, _contentLength));
|
||||
set contentLength(int? contentLength) =>
|
||||
super.noSuchMethod(Invocation.setter(#contentLength, contentLength));
|
||||
|
||||
@override
|
||||
bool get bufferOutput =>
|
||||
@ -295,8 +295,8 @@ class MockHttpClientRequest extends Mock implements HttpClientRequest {
|
||||
as bool;
|
||||
|
||||
@override
|
||||
set bufferOutput(bool? _bufferOutput) =>
|
||||
super.noSuchMethod(Invocation.setter(#bufferOutput, _bufferOutput));
|
||||
set bufferOutput(bool? bufferOutput) =>
|
||||
super.noSuchMethod(Invocation.setter(#bufferOutput, bufferOutput));
|
||||
|
||||
@override
|
||||
String get method =>
|
||||
@ -428,8 +428,8 @@ class MockHttpHeaders extends Mock implements HttpHeaders {
|
||||
as int;
|
||||
|
||||
@override
|
||||
set contentLength(int? _contentLength) =>
|
||||
super.noSuchMethod(Invocation.setter(#contentLength, _contentLength));
|
||||
set contentLength(int? contentLength) =>
|
||||
super.noSuchMethod(Invocation.setter(#contentLength, contentLength));
|
||||
|
||||
@override
|
||||
bool get persistentConnection =>
|
||||
@ -437,8 +437,8 @@ class MockHttpHeaders extends Mock implements HttpHeaders {
|
||||
returnValue: false) as bool;
|
||||
|
||||
@override
|
||||
set persistentConnection(bool? _persistentConnection) => super.noSuchMethod(
|
||||
Invocation.setter(#persistentConnection, _persistentConnection));
|
||||
set persistentConnection(bool? persistentConnection) => super.noSuchMethod(
|
||||
Invocation.setter(#persistentConnection, persistentConnection));
|
||||
|
||||
@override
|
||||
bool get chunkedTransferEncoding =>
|
||||
@ -446,9 +446,9 @@ class MockHttpHeaders extends Mock implements HttpHeaders {
|
||||
returnValue: false) as bool;
|
||||
|
||||
@override
|
||||
set chunkedTransferEncoding(bool? _chunkedTransferEncoding) =>
|
||||
super.noSuchMethod(Invocation.setter(
|
||||
#chunkedTransferEncoding, _chunkedTransferEncoding));
|
||||
set chunkedTransferEncoding(bool? chunkedTransferEncoding) =>
|
||||
super.noSuchMethod(
|
||||
Invocation.setter(#chunkedTransferEncoding, chunkedTransferEncoding));
|
||||
|
||||
@override
|
||||
List<String>? operator [](String? name) =>
|
||||
|
@ -702,7 +702,7 @@ void defineTests() {
|
||||
// Example 513b from GFM.
|
||||
'link title in single quotes',
|
||||
(WidgetTester tester) async {
|
||||
const String data = '[link](/url \'title\')';
|
||||
const String data = "[link](/url 'title')";
|
||||
MarkdownLink? linkTapResults;
|
||||
await tester.pumpWidget(
|
||||
boilerplate(
|
||||
@ -1202,7 +1202,7 @@ void defineTests() {
|
||||
|
||||
testWidgets(
|
||||
// Example 531 from GFM.
|
||||
'brackets that aren\'t part of links do not take precedence',
|
||||
"brackets that aren't part of links do not take precedence",
|
||||
(WidgetTester tester) async {
|
||||
const String data = '*foo [bar* baz]';
|
||||
await tester.pumpWidget(
|
||||
|
@ -22,7 +22,6 @@ void defineTests() {
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: MarkdownBody(
|
||||
data: 'This is a [link](https://flutter.dev/)',
|
||||
shrinkWrap: true,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -15,7 +15,7 @@ void defineTests() {
|
||||
'code block',
|
||||
(WidgetTester tester) async {
|
||||
const String data =
|
||||
'```\nvoid main() {\n print(\'Hello World!\');\n}\n```';
|
||||
"```\nvoid main() {\n print('Hello World!');\n}\n```";
|
||||
|
||||
await tester.pumpWidget(
|
||||
boilerplate(
|
||||
|
@ -10,8 +10,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
final TextTheme textTheme =
|
||||
Typography.material2018(platform: TargetPlatform.android)
|
||||
final TextTheme textTheme = Typography.material2018()
|
||||
.black
|
||||
.merge(const TextTheme(bodyMedium: TextStyle(fontSize: 12.0)));
|
||||
|
||||
@ -182,7 +181,7 @@ class TestAssetBundle extends CachingAssetBundle {
|
||||
// verses 'flutter test test/*_test.dart'. Adjust the root directory
|
||||
// to access the assets directory.
|
||||
final io.Directory rootDirectory =
|
||||
io.Directory.current.path.endsWith(io.Platform.pathSeparator + 'test')
|
||||
io.Directory.current.path.endsWith('${io.Platform.pathSeparator}test')
|
||||
? io.Directory.current.parent
|
||||
: io.Directory.current;
|
||||
final io.File file =
|
||||
@ -194,7 +193,7 @@ class TestAssetBundle extends CachingAssetBundle {
|
||||
}
|
||||
return asset;
|
||||
} else {
|
||||
throw 'Unknown asset key: $key';
|
||||
throw ArgumentError('Unknown asset key: $key');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
## 0.0.25+1
|
||||
|
||||
- Fixes lint warnings.
|
||||
|
||||
|
||||
## 0.0.25
|
||||
|
||||
- Fix `unnecessary_import` lint errors.
|
||||
|
@ -182,7 +182,7 @@ Future<OperationResult> ssh(
|
||||
final OperationResult result = await sshClient.runCommand(
|
||||
targetIp,
|
||||
identityFilePath: identityFile,
|
||||
command: args['command'].split(' '),
|
||||
command: (args['command'] as String).split(' '),
|
||||
timeoutMs:
|
||||
Duration(milliseconds: int.parse(args['timeout-seconds']) * 1000),
|
||||
logFilePath: outputFile,
|
||||
@ -203,7 +203,6 @@ Future<OperationResult> pave(
|
||||
) async {
|
||||
const ImagePaver paver = ImagePaver();
|
||||
const RetryOptions r = RetryOptions(
|
||||
maxDelay: Duration(seconds: 30),
|
||||
maxAttempts: 3,
|
||||
);
|
||||
return r.retry(() async {
|
||||
@ -268,7 +267,7 @@ Future<OperationResult> pushPackages(
|
||||
|
||||
final String repositoryBase = path.join(repo.path, 'amber-files');
|
||||
stdout.writeln('Serving $repositoryBase to $targetIp');
|
||||
await server.serveRepo(repositoryBase, port: 0);
|
||||
await server.serveRepo(repositoryBase);
|
||||
await amberCtl.addSrc(server.serverPort);
|
||||
|
||||
stdout.writeln('Pushing packages $packages to $targetIp');
|
||||
@ -335,7 +334,7 @@ Future<OperationResult> test(
|
||||
return result;
|
||||
}
|
||||
}
|
||||
await server.serveRepo(repo.path, port: 0);
|
||||
await server.serveRepo(repo.path);
|
||||
await amberCtl.addSrc(server.serverPort);
|
||||
|
||||
for (final String farFile in farFiles) {
|
||||
|
@ -4,10 +4,11 @@
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:fuchsia_ctl/fuchsia_ctl.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
import '../fuchsia_ctl.dart';
|
||||
|
||||
const SshClient _kSsh = SshClient();
|
||||
|
||||
/// Wrapper for amberctl utility for commands executed on the target device.
|
||||
|
@ -180,7 +180,7 @@ class Emulator {
|
||||
'-device', 'virtio-blk-pci,drive=vdisk',
|
||||
'-append',
|
||||
// TODO(chillers): Generate entropy mixin.
|
||||
'\'TERM=xterm-256color kernel.serial=legacy kernel.entropy-mixin=660486b6b20b4ace3fb5c81b0002abf5271289185c6a5620707606c55b377562 kernel.halt-on-panic=true\'',
|
||||
"'TERM=xterm-256color kernel.serial=legacy kernel.entropy-mixin=660486b6b20b4ace3fb5c81b0002abf5271289185c6a5620707606c55b377562 kernel.halt-on-panic=true'",
|
||||
];
|
||||
|
||||
await cli.start(aemuCommand);
|
||||
|
@ -26,7 +26,7 @@ class ImagePaver {
|
||||
const ImagePaver({
|
||||
this.processManager = const LocalProcessManager(),
|
||||
this.fs = const LocalFileSystem(),
|
||||
this.tar = const SystemTar(processManager: LocalProcessManager()),
|
||||
this.tar = const SystemTar(),
|
||||
this.sshKeyManagerProvider = SystemSshKeyManager.defaultProvider,
|
||||
}) : assert(processManager != null),
|
||||
assert(fs != null),
|
||||
|
@ -24,7 +24,7 @@ class OperationResult {
|
||||
String info = '',
|
||||
}) {
|
||||
assert(info != null);
|
||||
return OperationResult._(true, info: info, error: '');
|
||||
return OperationResult._(true, info: info);
|
||||
}
|
||||
|
||||
/// A failing operation result with a non-null but potentially empty error,
|
||||
|
@ -8,11 +8,12 @@ import 'dart:io';
|
||||
|
||||
import 'package:file/file.dart';
|
||||
import 'package:file/local.dart';
|
||||
import 'package:fuchsia_ctl/fuchsia_ctl.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:process/process.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
import '../fuchsia_ctl.dart';
|
||||
|
||||
/// A wrapper around the Fuchsia SDK `pm` tool.
|
||||
class PackageServer {
|
||||
/// Creates a new package server.
|
||||
|
@ -8,10 +8,10 @@ import 'dart:io';
|
||||
|
||||
import 'package:file/file.dart';
|
||||
import 'package:file/local.dart';
|
||||
import 'package:fuchsia_ctl/src/logger.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:process/process.dart';
|
||||
|
||||
import 'logger.dart';
|
||||
import 'operation_result.dart';
|
||||
|
||||
/// A client for running SSH based commands on a Fuchsia device.
|
||||
|
@ -6,7 +6,7 @@ description: >
|
||||
publish_to: none
|
||||
repository: https://github.com/flutter/packages/tree/main/packages/fuchsia_ctl
|
||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+fuchsia_ctl%22
|
||||
version: 0.0.25
|
||||
version: 0.0.25+1
|
||||
|
||||
environment:
|
||||
sdk: ">=2.4.0 <3.0.0"
|
||||
|
@ -23,7 +23,7 @@ void main() {
|
||||
group('Emulator', () {
|
||||
setUp(() {
|
||||
mockCli = MockCommandLine();
|
||||
fs = MemoryFileSystem(style: FileSystemStyle.posix);
|
||||
fs = MemoryFileSystem();
|
||||
fs.file(aemuPath).createSync();
|
||||
fs.file(fuchsiaImagePath)
|
||||
..createSync()
|
||||
|
@ -17,7 +17,7 @@ import 'fakes.dart';
|
||||
void main() {
|
||||
const String deviceName = 'some-name-to-use';
|
||||
FakeSshKeyManager sshKeyManager;
|
||||
final MemoryFileSystem fs = MemoryFileSystem(style: FileSystemStyle.posix);
|
||||
final MemoryFileSystem fs = MemoryFileSystem();
|
||||
FakeTar tar;
|
||||
MockProcessManager processManager;
|
||||
SshKeyManagerProvider sshKeyManagerProvider;
|
||||
|
@ -43,7 +43,7 @@ void main() {
|
||||
final MemoryFileSystem fs = MemoryFileSystem();
|
||||
fs.file('log.txt').createSync();
|
||||
final IOSink data = fs.file('log.txt').openWrite();
|
||||
final PrintLogger logger = PrintLogger(out: data, level: LogLevel.info);
|
||||
final PrintLogger logger = PrintLogger(out: data);
|
||||
logger.debug('abc');
|
||||
logger.info('cdf');
|
||||
logger.warning('gh');
|
||||
|
@ -109,7 +109,6 @@ void main() {
|
||||
|
||||
await server.serveRepo(
|
||||
repoPath,
|
||||
port: 0,
|
||||
portFilePath: portFile.path,
|
||||
);
|
||||
expect(server.serving, true);
|
||||
|
@ -1,6 +1,7 @@
|
||||
## NEXT
|
||||
## 4.2.9
|
||||
|
||||
* Updates text theme parameters to avoid deprecation issues.
|
||||
* Fixes lint warnings.
|
||||
|
||||
## 4.2.8
|
||||
|
||||
|
@ -17,7 +17,7 @@ class BooksScreen extends StatefulWidget {
|
||||
final String kind;
|
||||
|
||||
@override
|
||||
_BooksScreenState createState() => _BooksScreenState();
|
||||
State<BooksScreen> createState() => _BooksScreenState();
|
||||
}
|
||||
|
||||
class _BooksScreenState extends State<BooksScreen>
|
||||
|
@ -14,7 +14,7 @@ class SettingsScreen extends StatefulWidget {
|
||||
const SettingsScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_SettingsScreenState createState() => _SettingsScreenState();
|
||||
State<SettingsScreen> createState() => _SettingsScreenState();
|
||||
}
|
||||
|
||||
class _SettingsScreenState extends State<SettingsScreen> {
|
||||
|
@ -28,7 +28,7 @@ class SignInScreen extends StatefulWidget {
|
||||
final ValueChanged<Credentials> onSignIn;
|
||||
|
||||
@override
|
||||
_SignInScreenState createState() => _SignInScreenState();
|
||||
State<SignInScreen> createState() => _SignInScreenState();
|
||||
}
|
||||
|
||||
class _SignInScreenState extends State<SignInScreen> {
|
||||
|
@ -2,6 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// TODO(goderbauer): Refactor the examples to remove this ignore, https://github.com/flutter/flutter/issues/110210
|
||||
// ignore_for_file: avoid_dynamic_calls
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -2,6 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// TODO(goderbauer): Refactor the examples to remove this ignore, https://github.com/flutter/flutter/issues/110210
|
||||
// ignore_for_file: avoid_dynamic_calls
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -2,6 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// TODO(goderbauer): Refactor the examples to remove this ignore, https://github.com/flutter/flutter/issues/110210
|
||||
// ignore_for_file: avoid_dynamic_calls
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -6,7 +6,7 @@
|
||||
/// deep linking, data-driven routes and more.
|
||||
library go_router;
|
||||
|
||||
export 'src/configuration.dart' show GoRouterState, GoRoute;
|
||||
export 'src/configuration.dart' show GoRoute, GoRouterState;
|
||||
export 'src/misc/extensions.dart';
|
||||
export 'src/misc/inherited_router.dart';
|
||||
export 'src/misc/refresh_stream.dart';
|
||||
|
@ -115,6 +115,5 @@ class GoRouteInformationProvider extends RouteInformationProvider
|
||||
/// in use with the [GoRouteInformationParser].
|
||||
class DebugGoRouteInformation extends RouteInformation {
|
||||
/// Creates a [DebugGoRouteInformation].
|
||||
DebugGoRouteInformation({String? location, Object? state})
|
||||
: super(location: location, state: state);
|
||||
DebugGoRouteInformation({super.location, super.state});
|
||||
}
|
||||
|
@ -100,8 +100,7 @@ class RouteMatchList {
|
||||
/// An error that occurred during matching.
|
||||
class MatcherError extends Error {
|
||||
/// Constructs a [MatcherError].
|
||||
MatcherError(String message, this.location)
|
||||
: message = message + ': $location';
|
||||
MatcherError(String message, this.location) : message = '$message: $location';
|
||||
|
||||
/// The error message.
|
||||
final String message;
|
||||
|
@ -9,7 +9,7 @@ import 'extensions.dart';
|
||||
/// Default error page implementation for WidgetsApp.
|
||||
class ErrorScreen extends StatelessWidget {
|
||||
/// Provide an exception to this page for it to be displayed.
|
||||
const ErrorScreen(this.error, {Key? key}) : super(key: key);
|
||||
const ErrorScreen(this.error, {super.key});
|
||||
|
||||
/// The exception to be displayed.
|
||||
final Exception? error;
|
||||
@ -46,8 +46,7 @@ class _Button extends StatefulWidget {
|
||||
const _Button({
|
||||
required this.onPressed,
|
||||
required this.child,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final VoidCallback onPressed;
|
||||
|
||||
|
@ -14,10 +14,10 @@ import '../router.dart';
|
||||
class InheritedGoRouter extends InheritedWidget {
|
||||
/// Default constructor for the inherited go router.
|
||||
const InheritedGoRouter({
|
||||
required Widget child,
|
||||
required super.child,
|
||||
required this.goRouter,
|
||||
Key? key,
|
||||
}) : super(child: child, key: key);
|
||||
super.key,
|
||||
});
|
||||
|
||||
/// The [GoRouter] that is made available to the widget tree.
|
||||
final GoRouter goRouter;
|
||||
|
@ -30,7 +30,7 @@ CupertinoPage<void> pageBuilderForCupertinoApp({
|
||||
/// Default error page implementation for Cupertino.
|
||||
class CupertinoErrorScreen extends StatelessWidget {
|
||||
/// Provide an exception to this page for it to be displayed.
|
||||
const CupertinoErrorScreen(this.error, {Key? key}) : super(key: key);
|
||||
const CupertinoErrorScreen(this.error, {super.key});
|
||||
|
||||
/// The exception to be displayed.
|
||||
final Exception? error;
|
||||
|
@ -23,16 +23,11 @@ class CustomTransitionPage<T> extends Page<T> {
|
||||
this.barrierDismissible = false,
|
||||
this.barrierColor,
|
||||
this.barrierLabel,
|
||||
LocalKey? key,
|
||||
String? name,
|
||||
Object? arguments,
|
||||
String? restorationId,
|
||||
}) : super(
|
||||
key: key,
|
||||
name: name,
|
||||
arguments: arguments,
|
||||
restorationId: restorationId,
|
||||
);
|
||||
super.key,
|
||||
super.name,
|
||||
super.arguments,
|
||||
super.restorationId,
|
||||
});
|
||||
|
||||
/// The content to be shown in the Route created by this page.
|
||||
final Widget child;
|
||||
@ -160,19 +155,14 @@ class _CustomTransitionPageRoute<T> extends PageRoute<T> {
|
||||
class NoTransitionPage<T> extends CustomTransitionPage<T> {
|
||||
/// Constructor for a page with no transition functionality.
|
||||
const NoTransitionPage({
|
||||
required Widget child,
|
||||
String? name,
|
||||
Object? arguments,
|
||||
String? restorationId,
|
||||
LocalKey? key,
|
||||
required super.child,
|
||||
super.name,
|
||||
super.arguments,
|
||||
super.restorationId,
|
||||
super.key,
|
||||
}) : super(
|
||||
transitionsBuilder: _transitionsBuilder,
|
||||
transitionDuration: const Duration(microseconds: 1), // hack for #205
|
||||
key: key,
|
||||
name: name,
|
||||
arguments: arguments,
|
||||
restorationId: restorationId,
|
||||
child: child,
|
||||
transitionDuration: const Duration(microseconds: 1),
|
||||
);
|
||||
|
||||
static Widget _transitionsBuilder(
|
||||
|
@ -31,7 +31,7 @@ MaterialPage<void> pageBuilderForMaterialApp({
|
||||
/// Default error page implementation for Material.
|
||||
class MaterialErrorScreen extends StatelessWidget {
|
||||
/// Provide an exception to this page for it to be displayed.
|
||||
const MaterialErrorScreen(this.error, {Key? key}) : super(key: key);
|
||||
const MaterialErrorScreen(this.error, {super.key});
|
||||
|
||||
/// The exception to be displayed.
|
||||
final Exception? error;
|
||||
|
@ -66,7 +66,7 @@ String _escapeGroup(String group, String name) {
|
||||
/// 2. Call [patternToPath] with the `pathParameters` from the first step and
|
||||
/// the original `pattern` used for generating the [RegExp].
|
||||
String patternToPath(String pattern, Map<String, String> pathParameters) {
|
||||
final StringBuffer buffer = StringBuffer('');
|
||||
final StringBuffer buffer = StringBuffer();
|
||||
int start = 0;
|
||||
for (final RegExpMatch match in _parameterRegExp.allMatches(pattern)) {
|
||||
if (match.start > start) {
|
||||
|
@ -111,13 +111,10 @@ class RedirectionError extends Error implements UnsupportedError {
|
||||
final Uri location;
|
||||
|
||||
@override
|
||||
String toString() =>
|
||||
super.toString() +
|
||||
' ' +
|
||||
<String>[
|
||||
String toString() => '${super.toString()} ${<String>[
|
||||
...matches.map(
|
||||
(RouteMatchList routeMatches) => routeMatches.location.toString()),
|
||||
].join(' => ');
|
||||
].join(' => ')}';
|
||||
}
|
||||
|
||||
/// Adds the redirect to [redirects] if it is valid.
|
||||
|
@ -55,7 +55,7 @@ abstract class GoRouteData {
|
||||
.replace(
|
||||
queryParameters:
|
||||
// Avoid `?` in generated location if `queryParams` is empty
|
||||
queryParams?.isNotEmpty == true ? queryParams : null,
|
||||
queryParams?.isNotEmpty ?? false ? queryParams : null,
|
||||
)
|
||||
.toString();
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
name: go_router
|
||||
description: A declarative router for Flutter based on Navigation 2 supporting
|
||||
deep linking, data-driven routes and more
|
||||
version: 4.2.8
|
||||
version: 4.2.9
|
||||
repository: https://github.com/flutter/packages/tree/main/packages/go_router
|
||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+go_router%22
|
||||
|
||||
|
@ -93,7 +93,7 @@ void main() {
|
||||
}
|
||||
|
||||
class DummyStatefulWidget extends StatefulWidget {
|
||||
const DummyStatefulWidget({Key? key}) : super(key: key);
|
||||
const DummyStatefulWidget({super.key});
|
||||
|
||||
@override
|
||||
State<DummyStatefulWidget> createState() => _DummyStatefulWidgetState();
|
||||
|
@ -89,7 +89,7 @@ void main() {
|
||||
}
|
||||
|
||||
class HomeScreen extends StatelessWidget {
|
||||
const HomeScreen({Key? key}) : super(key: key);
|
||||
const HomeScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -102,7 +102,7 @@ class HomeScreen extends StatelessWidget {
|
||||
}
|
||||
|
||||
class LoginScreen extends StatelessWidget {
|
||||
const LoginScreen({Key? key}) : super(key: key);
|
||||
const LoginScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -241,7 +241,7 @@ class FakeRefreshListenable extends ChangeNotifier {
|
||||
}
|
||||
|
||||
class DummyStatefulWidget extends StatefulWidget {
|
||||
const DummyStatefulWidget({Key? key}) : super(key: key);
|
||||
const DummyStatefulWidget({super.key});
|
||||
|
||||
@override
|
||||
State<DummyStatefulWidget> createState() => _DummyStatefulWidgetState();
|
||||
|
@ -53,7 +53,7 @@ Widget widgetsAppBuilder({required Widget home}) {
|
||||
}
|
||||
|
||||
class DummyStatefulWidget extends StatefulWidget {
|
||||
const DummyStatefulWidget({Key? key}) : super(key: key);
|
||||
const DummyStatefulWidget({super.key});
|
||||
|
||||
@override
|
||||
State<DummyStatefulWidget> createState() => _DummyStatefulWidgetState();
|
||||
|
@ -19,8 +19,9 @@ const bool enableLogs = true;
|
||||
final Logger log = Logger('GoRouter tests');
|
||||
|
||||
void main() {
|
||||
if (enableLogs)
|
||||
if (enableLogs) {
|
||||
Logger.root.onRecord.listen((LogRecord e) => debugPrint('$e'));
|
||||
}
|
||||
|
||||
group('path routes', () {
|
||||
testWidgets('match home route', (WidgetTester tester) async {
|
||||
@ -178,7 +179,6 @@ void main() {
|
||||
final GoRouter router = await createRouter(routes, tester);
|
||||
router.go('/login/');
|
||||
final List<RouteMatch> matches = router.routerDelegate.matches.matches;
|
||||
print(matches);
|
||||
expect(matches, hasLength(1));
|
||||
expect(matches.first.subloc, '/login');
|
||||
expect(router.screenFor(matches.first).runtimeType, LoginScreen);
|
||||
@ -1290,7 +1290,6 @@ void main() {
|
||||
final GoRouter router = await createRouter(
|
||||
routes,
|
||||
tester,
|
||||
initialLocation: '/',
|
||||
);
|
||||
expect(router.routeInformationProvider.value.location, '/dummy');
|
||||
TestWidgetsFlutterBinding
|
||||
|
@ -71,7 +71,7 @@ void main() {
|
||||
expect(properties.properties.first.value, goRouter);
|
||||
});
|
||||
|
||||
testWidgets('mediates Widget\'s access to GoRouter.',
|
||||
testWidgets("mediates Widget's access to GoRouter.",
|
||||
(WidgetTester tester) async {
|
||||
final MockGoRouter router = MockGoRouter();
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
@ -99,21 +99,21 @@ bool setupInheritedGoRouterChange({
|
||||
}
|
||||
|
||||
class Page1 extends StatelessWidget {
|
||||
const Page1({Key? key}) : super(key: key);
|
||||
const Page1({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Container();
|
||||
}
|
||||
|
||||
class Page2 extends StatelessWidget {
|
||||
const Page2({Key? key}) : super(key: key);
|
||||
const Page2({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Container();
|
||||
}
|
||||
|
||||
class _MyWidget extends StatelessWidget {
|
||||
const _MyWidget({Key? key}) : super(key: key);
|
||||
const _MyWidget();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -9,11 +9,10 @@ import 'package:logging/logging.dart';
|
||||
void main() {
|
||||
// Reset the logger before each test.
|
||||
setUp(() {
|
||||
setLogging(enabled: false);
|
||||
setLogging();
|
||||
});
|
||||
test('setLogging enables log messages on the logger', () {
|
||||
log.onRecord
|
||||
.listen(expectAsync1<void, LogRecord>((LogRecord r) {}, count: 1));
|
||||
log.onRecord.listen(expectAsync1<void, LogRecord>((LogRecord r) {}));
|
||||
|
||||
setLogging(enabled: true);
|
||||
log.info('message');
|
||||
@ -23,7 +22,7 @@ void main() {
|
||||
log.onRecord
|
||||
.listen(expectAsync1<void, LogRecord>((LogRecord r) {}, count: 0));
|
||||
|
||||
setLogging(enabled: false);
|
||||
setLogging();
|
||||
log.info('message');
|
||||
});
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ void main() {
|
||||
}
|
||||
|
||||
class DummyStatefulWidget extends StatefulWidget {
|
||||
const DummyStatefulWidget({Key? key}) : super(key: key);
|
||||
const DummyStatefulWidget({super.key});
|
||||
|
||||
@override
|
||||
State<DummyStatefulWidget> createState() => _DummyStatefulWidgetState();
|
||||
|
@ -100,10 +100,7 @@ void main() {
|
||||
expect(configuration.namedLocation('SNAKE_CASE'), '/hij');
|
||||
|
||||
// With query parameters
|
||||
expect(
|
||||
configuration
|
||||
.namedLocation('lowercase', queryParams: const <String, String>{}),
|
||||
'/abc');
|
||||
expect(configuration.namedLocation('lowercase'), '/abc');
|
||||
expect(
|
||||
configuration.namedLocation('lowercase',
|
||||
queryParams: const <String, String>{'q': '1'}),
|
||||
|
@ -74,32 +74,32 @@ void main() {
|
||||
});
|
||||
|
||||
test('concatenatePaths', () {
|
||||
void _verify(String pathA, String pathB, String expected) {
|
||||
void verify(String pathA, String pathB, String expected) {
|
||||
final String result = concatenatePaths(pathA, pathB);
|
||||
expect(result, expected);
|
||||
}
|
||||
|
||||
void _verifyThrows(String pathA, String pathB) {
|
||||
void verifyThrows(String pathA, String pathB) {
|
||||
expect(
|
||||
() => concatenatePaths(pathA, pathB), throwsA(isA<AssertionError>()));
|
||||
}
|
||||
|
||||
_verify('/a', 'b/c', '/a/b/c');
|
||||
_verify('/', 'b', '/b');
|
||||
_verifyThrows('/a', '/b');
|
||||
_verifyThrows('/a', '/');
|
||||
_verifyThrows('/', '/');
|
||||
_verifyThrows('/', '');
|
||||
_verifyThrows('', '');
|
||||
verify('/a', 'b/c', '/a/b/c');
|
||||
verify('/', 'b', '/b');
|
||||
verifyThrows('/a', '/b');
|
||||
verifyThrows('/a', '/');
|
||||
verifyThrows('/', '/');
|
||||
verifyThrows('/', '');
|
||||
verifyThrows('', '');
|
||||
});
|
||||
|
||||
test('canonicalUri', () {
|
||||
void _verify(String path, String expected) =>
|
||||
void verify(String path, String expected) =>
|
||||
expect(canonicalUri(path), expected);
|
||||
_verify('/a', '/a');
|
||||
_verify('/a/', '/a');
|
||||
_verify('/', '/');
|
||||
_verify('/a/b/', '/a/b');
|
||||
verify('/a', '/a');
|
||||
verify('/a/', '/a');
|
||||
verify('/', '/');
|
||||
verify('/a/b/', '/a/b');
|
||||
|
||||
expect(() => canonicalUri('::::'), throwsA(isA<FormatException>()));
|
||||
expect(() => canonicalUri(''), throwsA(anything));
|
||||
|
@ -4,8 +4,6 @@
|
||||
|
||||
// ignore_for_file: cascade_invocations, diagnostic_describe_all_properties
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/src/foundation/diagnostics.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
@ -43,8 +41,7 @@ Widget fakeNavigationBuilder(
|
||||
child;
|
||||
|
||||
class GoRouterNamedLocationSpy extends GoRouter {
|
||||
GoRouterNamedLocationSpy({required List<GoRoute> routes})
|
||||
: super(routes: routes);
|
||||
GoRouterNamedLocationSpy({required super.routes});
|
||||
|
||||
String? name;
|
||||
Map<String, String>? params;
|
||||
@ -64,7 +61,7 @@ class GoRouterNamedLocationSpy extends GoRouter {
|
||||
}
|
||||
|
||||
class GoRouterGoSpy extends GoRouter {
|
||||
GoRouterGoSpy({required List<GoRoute> routes}) : super(routes: routes);
|
||||
GoRouterGoSpy({required super.routes});
|
||||
|
||||
String? myLocation;
|
||||
Object? extra;
|
||||
@ -77,7 +74,7 @@ class GoRouterGoSpy extends GoRouter {
|
||||
}
|
||||
|
||||
class GoRouterGoNamedSpy extends GoRouter {
|
||||
GoRouterGoNamedSpy({required List<GoRoute> routes}) : super(routes: routes);
|
||||
GoRouterGoNamedSpy({required super.routes});
|
||||
|
||||
String? name;
|
||||
Map<String, String>? params;
|
||||
@ -99,7 +96,7 @@ class GoRouterGoNamedSpy extends GoRouter {
|
||||
}
|
||||
|
||||
class GoRouterPushSpy extends GoRouter {
|
||||
GoRouterPushSpy({required List<GoRoute> routes}) : super(routes: routes);
|
||||
GoRouterPushSpy({required super.routes});
|
||||
|
||||
String? myLocation;
|
||||
Object? extra;
|
||||
@ -112,7 +109,7 @@ class GoRouterPushSpy extends GoRouter {
|
||||
}
|
||||
|
||||
class GoRouterPushNamedSpy extends GoRouter {
|
||||
GoRouterPushNamedSpy({required List<GoRoute> routes}) : super(routes: routes);
|
||||
GoRouterPushNamedSpy({required super.routes});
|
||||
|
||||
String? name;
|
||||
Map<String, String>? params;
|
||||
@ -134,7 +131,7 @@ class GoRouterPushNamedSpy extends GoRouter {
|
||||
}
|
||||
|
||||
class GoRouterPopSpy extends GoRouter {
|
||||
GoRouterPopSpy({required List<GoRoute> routes}) : super(routes: routes);
|
||||
GoRouterPopSpy({required super.routes});
|
||||
|
||||
bool popped = false;
|
||||
|
||||
@ -146,9 +143,8 @@ class GoRouterPopSpy extends GoRouter {
|
||||
|
||||
class GoRouterRefreshStreamSpy extends GoRouterRefreshStream {
|
||||
GoRouterRefreshStreamSpy(
|
||||
Stream<dynamic> stream,
|
||||
) : notifyCount = 0,
|
||||
super(stream);
|
||||
super.stream,
|
||||
) : notifyCount = 0;
|
||||
|
||||
late int notifyCount;
|
||||
|
||||
@ -173,7 +169,6 @@ Future<GoRouter> createRouter(
|
||||
redirectLimit: redirectLimit,
|
||||
errorBuilder: (BuildContext context, GoRouterState state) =>
|
||||
TestErrorScreen(state.error!),
|
||||
debugLogDiagnostics: false,
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp.router(
|
||||
@ -186,44 +181,44 @@ Future<GoRouter> createRouter(
|
||||
}
|
||||
|
||||
class TestErrorScreen extends DummyScreen {
|
||||
const TestErrorScreen(this.ex, {Key? key}) : super(key: key);
|
||||
const TestErrorScreen(this.ex, {super.key});
|
||||
final Exception ex;
|
||||
}
|
||||
|
||||
class HomeScreen extends DummyScreen {
|
||||
const HomeScreen({Key? key}) : super(key: key);
|
||||
const HomeScreen({super.key});
|
||||
}
|
||||
|
||||
class Page1Screen extends DummyScreen {
|
||||
const Page1Screen({Key? key}) : super(key: key);
|
||||
const Page1Screen({super.key});
|
||||
}
|
||||
|
||||
class Page2Screen extends DummyScreen {
|
||||
const Page2Screen({Key? key}) : super(key: key);
|
||||
const Page2Screen({super.key});
|
||||
}
|
||||
|
||||
class LoginScreen extends DummyScreen {
|
||||
const LoginScreen({Key? key}) : super(key: key);
|
||||
const LoginScreen({super.key});
|
||||
}
|
||||
|
||||
class FamilyScreen extends DummyScreen {
|
||||
const FamilyScreen(this.fid, {Key? key}) : super(key: key);
|
||||
const FamilyScreen(this.fid, {super.key});
|
||||
final String fid;
|
||||
}
|
||||
|
||||
class FamiliesScreen extends DummyScreen {
|
||||
const FamiliesScreen({required this.selectedFid, Key? key}) : super(key: key);
|
||||
const FamiliesScreen({required this.selectedFid, super.key});
|
||||
final String selectedFid;
|
||||
}
|
||||
|
||||
class PersonScreen extends DummyScreen {
|
||||
const PersonScreen(this.fid, this.pid, {Key? key}) : super(key: key);
|
||||
const PersonScreen(this.fid, this.pid, {super.key});
|
||||
final String fid;
|
||||
final String pid;
|
||||
}
|
||||
|
||||
class DummyScreen extends StatelessWidget {
|
||||
const DummyScreen({Key? key}) : super(key: key);
|
||||
const DummyScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => const Placeholder();
|
||||
@ -336,7 +331,7 @@ class DummyBuildContext implements BuildContext {
|
||||
}
|
||||
|
||||
class DummyStatefulWidget extends StatefulWidget {
|
||||
const DummyStatefulWidget({Key? key}) : super(key: key);
|
||||
const DummyStatefulWidget({super.key});
|
||||
|
||||
@override
|
||||
State<DummyStatefulWidget> createState() => DummyStatefulWidgetState();
|
||||
|
@ -1,3 +1,7 @@
|
||||
## 1.0.9
|
||||
|
||||
* Fixes lint warnings.
|
||||
|
||||
## 1.0.8
|
||||
|
||||
* Updates `analyzer` to 4.4.0.
|
||||
|
@ -219,7 +219,7 @@ GoRoute get $_routeGetterName => ${_routeDefinition()};
|
||||
'Token ($e) of type ${e.runtimeType} is not supported.',
|
||||
);
|
||||
});
|
||||
return "'${pathItems.join('')}'";
|
||||
return "'${pathItems.join()}'";
|
||||
}
|
||||
|
||||
late final Set<String> _pathParams = Set<String>.unmodifiable(_parsedPath
|
||||
@ -249,7 +249,7 @@ GoRoute get $_routeGetterName => ${_routeDefinition()};
|
||||
final String routesBit = _children.isEmpty
|
||||
? ''
|
||||
: '''
|
||||
routes: [${_children.map((RouteConfig e) => '${e._routeDefinition()},').join('')}],
|
||||
routes: [${_children.map((RouteConfig e) => '${e._routeDefinition()},').join()}],
|
||||
''';
|
||||
|
||||
return '''
|
||||
|
@ -2,7 +2,7 @@ name: go_router_builder
|
||||
description: >-
|
||||
A builder that supports generated strongly-typed route helpers for
|
||||
package:go_router
|
||||
version: 1.0.8
|
||||
version: 1.0.9
|
||||
repository: https://github.com/flutter/packages/tree/main/packages/go_router_builder
|
||||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+go_router_builder%22
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
## 0.0.2+1
|
||||
|
||||
* Fixes lint warnings.
|
||||
|
||||
## 0.0.2
|
||||
|
||||
* Migrate to null safety.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user