Skip to content

Commit

Permalink
Merge pull request #58 from Femtopedia/master
Browse files Browse the repository at this point in the history
Migrate to null-safety
  • Loading branch information
letsar authored Apr 10, 2021
2 parents b2f00df + 97f2695 commit ea97f54
Show file tree
Hide file tree
Showing 16 changed files with 192 additions and 189 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.6.0
### Changed
* Migrated to sound null-safety.
* Increase the minimum version of Flutter.
* Increase the minimum version of Dart SDK.

## 0.5.0
### Changed
* The minimum version of Flutter.
Expand Down
18 changes: 9 additions & 9 deletions example/lib/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import 'package:flutter_sticky_header/flutter_sticky_header.dart';

class AppScaffold extends StatelessWidget {
const AppScaffold({
Key key,
@required this.title,
@required this.slivers,
Key? key,
required this.title,
required this.slivers,
this.reverse = false,
}) : super(key: key);

Expand All @@ -32,7 +32,7 @@ class AppScaffold extends StatelessWidget {

class _FloatingActionButton extends StatelessWidget {
const _FloatingActionButton({
Key key,
Key? key,
}) : super(key: key);

@override
Expand All @@ -42,8 +42,8 @@ class _FloatingActionButton extends StatelessWidget {
backgroundColor: Colors.green,
onPressed: () {
final double offset =
DefaultStickyHeaderController.of(context).stickyHeaderScrollOffset;
PrimaryScrollController.of(context).animateTo(
DefaultStickyHeaderController.of(context)!.stickyHeaderScrollOffset;
PrimaryScrollController.of(context)!.animateTo(
offset,
duration: Duration(milliseconds: 300),
curve: Curves.easeIn,
Expand All @@ -55,14 +55,14 @@ class _FloatingActionButton extends StatelessWidget {

class Header extends StatelessWidget {
const Header({
Key key,
Key? key,
this.index,
this.title,
this.color = Colors.lightBlue,
}) : super(key: key);

final String title;
final int index;
final String? title;
final int? index;
final Color color;

@override
Expand Down
14 changes: 7 additions & 7 deletions example/lib/examples/animated_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import '../common.dart';

class AnimatedHeaderExample extends StatelessWidget {
const AnimatedHeaderExample({
Key key,
Key? key,
}) : super(key: key);

@override
Expand All @@ -24,11 +24,11 @@ class AnimatedHeaderExample extends StatelessWidget {

class _StickyHeaderList extends StatelessWidget {
const _StickyHeaderList({
Key key,
Key? key,
this.index,
}) : super(key: key);

final int index;
final int? index;

@override
Widget build(BuildContext context) {
Expand All @@ -54,19 +54,19 @@ class _StickyHeaderList extends StatelessWidget {

class _AnimatedHeader extends StatelessWidget {
const _AnimatedHeader({
Key key,
Key? key,
this.state,
this.index,
}) : super(key: key);

final int index;
final SliverStickyHeaderState state;
final int? index;
final SliverStickyHeaderState? state;

@override
Widget build(BuildContext context) {
return Header(
index: index,
color: Colors.lightBlue.withOpacity(1 - state.scrollPercentage),
color: Colors.lightBlue.withOpacity(1 - state!.scrollPercentage),
);
}
}
6 changes: 3 additions & 3 deletions example/lib/examples/grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import '../common.dart';

class GridExample extends StatelessWidget {
const GridExample({
Key key,
Key? key,
}) : super(key: key);

@override
Expand All @@ -24,11 +24,11 @@ class GridExample extends StatelessWidget {

class _StickyHeaderGrid extends StatelessWidget {
const _StickyHeaderGrid({
Key key,
Key? key,
this.index,
}) : super(key: key);

final int index;
final int? index;

@override
Widget build(BuildContext context) {
Expand Down
6 changes: 3 additions & 3 deletions example/lib/examples/list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import '../common.dart';

class ListExample extends StatelessWidget {
const ListExample({
Key key,
Key? key,
}) : super(key: key);

@override
Expand All @@ -24,11 +24,11 @@ class ListExample extends StatelessWidget {

class _StickyHeaderList extends StatelessWidget {
const _StickyHeaderList({
Key key,
Key? key,
this.index,
}) : super(key: key);

final int index;
final int? index;

@override
Widget build(BuildContext context) {
Expand Down
6 changes: 3 additions & 3 deletions example/lib/examples/mix_slivers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import '../common.dart';

class MixSliversExample extends StatelessWidget {
const MixSliversExample({
Key key,
Key? key,
}) : super(key: key);

@override
Expand Down Expand Up @@ -36,11 +36,11 @@ class MixSliversExample extends StatelessWidget {

class _StickyHeaderList extends StatelessWidget {
const _StickyHeaderList({
Key key,
Key? key,
this.index,
}) : super(key: key);

final int index;
final int? index;

@override
Widget build(BuildContext context) {
Expand Down
6 changes: 3 additions & 3 deletions example/lib/examples/not_sticky.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import '../common.dart';

class NotStickyExample extends StatelessWidget {
const NotStickyExample({
Key key,
Key? key,
}) : super(key: key);

@override
Expand All @@ -24,11 +24,11 @@ class NotStickyExample extends StatelessWidget {

class _NotStickyList extends StatelessWidget {
const _NotStickyList({
Key key,
Key? key,
this.index,
}) : super(key: key);

final int index;
final int? index;

@override
Widget build(BuildContext context) {
Expand Down
6 changes: 3 additions & 3 deletions example/lib/examples/reverse.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import '../common.dart';

class ReverseExample extends StatelessWidget {
const ReverseExample({
Key key,
Key? key,
}) : super(key: key);

@override
Expand All @@ -25,11 +25,11 @@ class ReverseExample extends StatelessWidget {

class _StickyHeaderList extends StatelessWidget {
const _StickyHeaderList({
Key key,
Key? key,
this.index,
}) : super(key: key);

final int index;
final int? index;

@override
Widget build(BuildContext context) {
Expand Down
10 changes: 5 additions & 5 deletions example/lib/examples/side_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import '../common.dart';

class SideHeaderExample extends StatelessWidget {
const SideHeaderExample({
Key key,
Key? key,
}) : super(key: key);

@override
Expand All @@ -24,11 +24,11 @@ class SideHeaderExample extends StatelessWidget {

class _StickyHeaderGrid extends StatelessWidget {
const _StickyHeaderGrid({
Key key,
Key? key,
this.index,
}) : super(key: key);

final int index;
final int? index;

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -68,11 +68,11 @@ class _StickyHeaderGrid extends StatelessWidget {

class _SideHeader extends StatelessWidget {
const _SideHeader({
Key key,
Key? key,
this.index,
}) : super(key: key);

final int index;
final int? index;

@override
Widget build(BuildContext context) {
Expand Down
18 changes: 9 additions & 9 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import 'package:flutter/material.dart';

import 'examples/list.dart';
import 'examples/animated_header.dart';
import 'examples/grid.dart';
import 'examples/list.dart';
import 'examples/mix_slivers.dart';
import 'examples/not_sticky.dart';
import 'examples/side_header.dart';
import 'examples/animated_header.dart';
import 'examples/reverse.dart';
import 'examples/mix_slivers.dart';
import 'examples/side_header.dart';

void main() => runApp(const App());

class App extends StatelessWidget {
const App({
Key key,
Key? key,
}) : super(key: key);

@override
Expand All @@ -26,7 +26,7 @@ class App extends StatelessWidget {

class _Home extends StatelessWidget {
const _Home({
Key key,
Key? key,
}) : super(key: key);

@override
Expand Down Expand Up @@ -73,9 +73,9 @@ class _Home extends StatelessWidget {

class _Item extends StatelessWidget {
const _Item({
Key key,
@required this.text,
@required this.builder,
Key? key,
required this.text,
required this.builder,
}) : super(key: key);

final String text;
Expand Down
4 changes: 2 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1

environment:
sdk: ">=2.7.0 <3.0.0"
sdk: '>=2.12.0 <3.0.0'

dependencies:
flutter:
Expand All @@ -29,7 +29,7 @@ dependencies:

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
cupertino_icons: ^1.0.2

dev_dependencies:
flutter_test:
Expand Down
Loading

0 comments on commit ea97f54

Please sign in to comment.