Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: updating the project to version 3.22 and removing warnings #101

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class _MyHomePageState extends State<MyHomePage> {
child: Text('Toggle enablePulsingAnimation',
style: Theme.of(context)
.textTheme
.button!
.labelLarge!
.copyWith(color: Colors.white)),
),
const Text(
Expand All @@ -126,7 +126,7 @@ class _MyHomePageState extends State<MyHomePage> {
child: Text('Toggle overflowMode',
style: Theme.of(context)
.textTheme
.button!
.labelLarge!
.copyWith(color: Colors.white)),
),
for (int n = 42; n > 0; n--)
Expand Down Expand Up @@ -158,7 +158,7 @@ class _MyHomePageState extends State<MyHomePage> {
'Understood',
style: Theme.of(context)
.textTheme
.button!
.labelLarge!
.copyWith(color: Colors.white),
),
),
Expand All @@ -168,7 +168,7 @@ class _MyHomePageState extends State<MyHomePage> {
'Dismiss',
style: Theme.of(context)
.textTheme
.button!
.labelLarge!
.copyWith(color: Colors.white),
),
),
Expand Down Expand Up @@ -201,7 +201,7 @@ class _MyHomePageState extends State<MyHomePage> {
child: Text('Add another item',
style: Theme.of(context)
.textTheme
.button!
.labelLarge!
.copyWith(color: Colors.white)),
),
for (int n = feature3ItemCount; n > 0; n--)
Expand Down Expand Up @@ -234,7 +234,7 @@ class _ContentState extends State<Content> {
ensureKey = GlobalKey<EnsureVisibleState>();
ensureKey2 = GlobalKey<EnsureVisibleState>();

WidgetsBinding.instance!.addPostFrameCallback((_) {
WidgetsBinding.instance.addPostFrameCallback((_) {
FeatureDiscovery.discoverFeatures(
context,
const <String>{
Expand Down Expand Up @@ -275,10 +275,10 @@ class _ContentState extends State<Content> {
width: double.infinity,
padding: const EdgeInsets.all(16.0),
color: Colors.blue,
child: Column(
child: const Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const Padding(
Padding(
padding: EdgeInsets.only(bottom: 8.0),
child: Text(
'DISH REPUBLIC',
Expand All @@ -288,7 +288,7 @@ class _ContentState extends State<Content> {
),
),
),
const Text(
Text(
'Eat',
style: TextStyle(
color: Colors.white,
Expand All @@ -314,7 +314,7 @@ class _ContentState extends State<Content> {
return true;
},
onOpen: () async {
WidgetsBinding.instance!.addPostFrameCallback((_) {
WidgetsBinding.instance.addPostFrameCallback((_) {
ensureKey!.currentState!.ensureVisible(
preciseAlignment: 0.5,
duration: const Duration(milliseconds: 400),
Expand Down Expand Up @@ -364,7 +364,7 @@ class _ContentState extends State<Content> {
return true;
},
onOpen: () async {
WidgetsBinding.instance!.addPostFrameCallback((_) {
WidgetsBinding.instance.addPostFrameCallback((_) {
ensureKey2!.currentState!.ensureVisible(
duration: const Duration(milliseconds: 600));
});
Expand All @@ -380,7 +380,7 @@ class _ContentState extends State<Content> {
child: Text('Add item',
style: Theme.of(context)
.textTheme
.button!
.labelLarge!
.copyWith(color: Colors.white)),
),
for (int n = feature6ItemCount; n > 0; n--)
Expand Down
5 changes: 2 additions & 3 deletions lib/src/widgets/content.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:feature_discovery/src/rendering.dart';
import 'package:feature_discovery/src/widgets.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

class Content extends StatelessWidget {
final FeatureOverlayState state;
Expand Down Expand Up @@ -72,7 +71,7 @@ class Content extends StatelessWidget {
DefaultTextStyle(
style: Theme.of(context)
.textTheme
.headline6!
.titleLarge!
.copyWith(color: textColor),
child: title!,
),
Expand All @@ -82,7 +81,7 @@ class Content extends StatelessWidget {
DefaultTextStyle(
style: Theme.of(context)
.textTheme
.bodyText2!
.bodyMedium!
.copyWith(color: textColor.withOpacity(0.9)),
child: description!,
)
Expand Down
4 changes: 2 additions & 2 deletions lib/src/widgets/ensure_visible.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ class EnsureVisibleState extends State<EnsureVisible> {
'The alignment needs to be null or between 0 and 1.');

final renderObject = context.findRenderObject();
final viewport = RenderAbstractViewport.of(renderObject)!;
final viewport = RenderAbstractViewport.of(renderObject);

final scrollableState = Scrollable.of(context)!;
final scrollableState = Scrollable.of(context);

final position = scrollableState.position;
double alignment;
Expand Down
6 changes: 3 additions & 3 deletions lib/src/widgets/layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ class _OverlayBuilderState extends State<OverlayBuilder> {
overlayEntry = OverlayEntry(
builder: widget.overlayBuilder as Widget Function(BuildContext),
);
WidgetsBinding.instance!.addPostFrameCallback((_) {
Overlay.of(context)!.insert(overlayEntry!);
WidgetsBinding.instance.addPostFrameCallback((_) {
Overlay.of(context).insert(overlayEntry!);
});
}

Expand All @@ -109,7 +109,7 @@ class _OverlayBuilderState extends State<OverlayBuilder> {

@override
Widget build(BuildContext context) {
WidgetsBinding.instance!.addPostFrameCallback((_) {
WidgetsBinding.instance.addPostFrameCallback((_) {
buildOverlay();
});
return widget.child!;
Expand Down
4 changes: 1 addition & 3 deletions test/feature_discovery_test.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:feature_discovery/feature_discovery.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';

import 'widgets.dart';
Expand Down Expand Up @@ -202,8 +201,7 @@ void main() {
// The Container that makes the content of the feature overlay of the test widget has a static
// height of 9e3, which ensures that the content definitely covers the 4e3 surface size height
// if OverflowMode.clipContent is not enabled.
await (TestWidgetsFlutterBinding.ensureInitialized()
as TestWidgetsFlutterBinding)
await (TestWidgetsFlutterBinding.ensureInitialized())
.setSurfaceSize(const Size(3e2, 4e3));

await tester.pumpWidget(
Expand Down