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

Cleaning #90

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
28 changes: 28 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
39 changes: 37 additions & 2 deletions example/.metadata
Original file line number Diff line number Diff line change
@@ -1,10 +1,45 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
# This file should be version controlled.

version:
revision: bbfbf1770cca2da7c82e887e4e4af910034800b6
revision: f72efea43c3013323d1b95cff571f3c1caa37583
channel: stable

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: f72efea43c3013323d1b95cff571f3c1caa37583
base_revision: f72efea43c3013323d1b95cff571f3c1caa37583
- platform: android
create_revision: f72efea43c3013323d1b95cff571f3c1caa37583
base_revision: f72efea43c3013323d1b95cff571f3c1caa37583
- platform: ios
create_revision: f72efea43c3013323d1b95cff571f3c1caa37583
base_revision: f72efea43c3013323d1b95cff571f3c1caa37583
- platform: linux
create_revision: f72efea43c3013323d1b95cff571f3c1caa37583
base_revision: f72efea43c3013323d1b95cff571f3c1caa37583
- platform: macos
create_revision: f72efea43c3013323d1b95cff571f3c1caa37583
base_revision: f72efea43c3013323d1b95cff571f3c1caa37583
- platform: web
create_revision: f72efea43c3013323d1b95cff571f3c1caa37583
base_revision: f72efea43c3013323d1b95cff571f3c1caa37583
- platform: windows
create_revision: f72efea43c3013323d1b95cff571f3c1caa37583
base_revision: f72efea43c3013323d1b95cff571f3c1caa37583

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
29 changes: 29 additions & 0 deletions example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
10 changes: 5 additions & 5 deletions example/lib/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ class _FloatingActionButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return FloatingActionButton(
child: Icon(Icons.adjust),
backgroundColor: Colors.green,
onPressed: () {
final double offset =
DefaultStickyHeaderController.of(context)!.stickyHeaderScrollOffset;
PrimaryScrollController.of(context)!.animateTo(
PrimaryScrollController.of(context).animateTo(
offset,
duration: Duration(milliseconds: 300),
duration: const Duration(milliseconds: 300),
curve: Curves.easeIn,
);
},
child: const Icon(Icons.adjust),
);
}
}
Expand All @@ -69,12 +69,12 @@ class Header extends StatelessWidget {
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
print('hit $index');
debugPrint('hit $index');
},
child: Container(
height: 60,
color: color,
padding: EdgeInsets.symmetric(horizontal: 16.0),
padding: const EdgeInsets.symmetric(horizontal: 16.0),
alignment: Alignment.centerLeft,
child: Text(
title ?? 'Header #$index',
Expand Down
2 changes: 1 addition & 1 deletion example/lib/examples/animated_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class AnimatedHeaderExample extends StatelessWidget {

@override
Widget build(BuildContext context) {
return AppScaffold(
return const AppScaffold(
title: 'Animated header Example',
slivers: [
_StickyHeaderList(index: 0),
Expand Down
14 changes: 7 additions & 7 deletions example/lib/examples/grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class GridExample extends StatelessWidget {

@override
Widget build(BuildContext context) {
return AppScaffold(
return const AppScaffold(
title: 'Grid Example',
slivers: [
_StickyHeaderGrid(index: 0),
Expand All @@ -35,15 +35,10 @@ class _StickyHeaderGrid extends StatelessWidget {
return SliverStickyHeader(
header: Header(index: index),
sliver: SliverGrid(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, crossAxisSpacing: 4.0, mainAxisSpacing: 4.0),
delegate: SliverChildBuilderDelegate(
(context, i) => GridTile(
child: Card(
child: Container(
color: Colors.green,
),
),
footer: Container(
color: Colors.white.withOpacity(0.5),
child: Padding(
Expand All @@ -54,6 +49,11 @@ class _StickyHeaderGrid extends StatelessWidget {
),
),
),
child: Card(
child: Container(
color: Colors.green,
),
),
),
childCount: 9,
),
Expand Down
4 changes: 2 additions & 2 deletions example/lib/examples/list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ListExample extends StatelessWidget {

@override
Widget build(BuildContext context) {
return AppScaffold(
return const AppScaffold(
title: 'List Example',
slivers: [
_StickyHeaderList(index: 0),
Expand Down Expand Up @@ -38,7 +38,7 @@ class _StickyHeaderList extends StatelessWidget {
delegate: SliverChildBuilderDelegate(
(context, i) => ListTile(
onTap: () {
print('tile $i');
debugPrint('tile $i');
},
leading: CircleAvatar(
child: Text('$index'),
Expand Down
10 changes: 5 additions & 5 deletions example/lib/examples/mix_slivers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MixSliversExample extends StatelessWidget {
return AppScaffold(
title: 'List Example',
slivers: [
SliverAppBar(
const SliverAppBar(
backgroundColor: Colors.orange,
title: Text('SliverAppBar'),
automaticallyImplyLeading: false,
Expand All @@ -25,10 +25,10 @@ class MixSliversExample extends StatelessWidget {
color: Colors.red,
),
),
_StickyHeaderList(index: 0),
_StickyHeaderList(index: 1),
_StickyHeaderList(index: 2),
_StickyHeaderList(index: 3),
const _StickyHeaderList(index: 0),
const _StickyHeaderList(index: 1),
const _StickyHeaderList(index: 2),
const _StickyHeaderList(index: 3),
],
);
}
Expand Down
26 changes: 13 additions & 13 deletions example/lib/examples/nested.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ class NestedExample extends StatelessWidget {
title: 'Nested Sticky Headers',
slivers: [
SliverStickyHeader(
header: Header(title: '1'),
header: const Header(title: '1'),
sliver: MultiSliver(
children: [
SliverStickyHeader(
const SliverStickyHeader(
header: Header(title: '1.1'),
sliver: _SliverLeaf(),
),
SliverStickyHeader(
header: Header(title: '1.2'),
header: const Header(title: '1.2'),
sliver: MultiSliver(
children: [
children: const [
SliverStickyHeader(
header: Header(title: '1.2.1'),
sliver: _SliverLeaf(),
Expand All @@ -40,25 +40,25 @@ class NestedExample extends StatelessWidget {
],
),
),
SliverStickyHeader(
const SliverStickyHeader(
header: Header(title: '1.3'),
sliver: _SliverLeaf(),
),
],
),
),
SliverStickyHeader(
header: Header(title: '2'),
header: const Header(title: '2'),
sliver: MultiSliver(
children: [
SliverStickyHeader(
const SliverStickyHeader(
header: Header(title: '2.1'),
sliver: _SliverLeaf(),
),
SliverStickyHeader(
header: Header(title: '2.2'),
header: const Header(title: '2.2'),
sliver: MultiSliver(
children: [
children: const [
SliverStickyHeader(
header: Header(title: '2.2.1'),
sliver: _SliverLeaf(),
Expand All @@ -74,21 +74,21 @@ class NestedExample extends StatelessWidget {
],
),
),
SliverStickyHeader(
const SliverStickyHeader(
header: Header(title: '2.3'),
sliver: _SliverLeaf(),
),
],
),
),
SliverStickyHeader(
const SliverStickyHeader(
header: Header(title: '3'),
sliver: _SliverLeaf(),
),
SliverStickyHeader(
header: Header(title: '4'),
header: const Header(title: '4'),
sliver: MultiSliver(
children: [
children: const [
SliverStickyHeader(
header: Header(title: '4.1'),
sliver: _SliverLeaf(),
Expand Down
4 changes: 2 additions & 2 deletions example/lib/examples/not_sticky.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class NotStickyExample extends StatelessWidget {

@override
Widget build(BuildContext context) {
return AppScaffold(
return const AppScaffold(
title: 'Not Sticky Example',
slivers: [
_NotStickyList(index: 0),
Expand Down Expand Up @@ -39,7 +39,7 @@ class _NotStickyList extends StatelessWidget {
delegate: SliverChildBuilderDelegate(
(context, i) => ListTile(
onTap: () {
print('tile $i');
debugPrint('tile $i');
},
leading: CircleAvatar(
child: Text('$index'),
Expand Down
2 changes: 1 addition & 1 deletion example/lib/examples/reverse.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ReverseExample extends StatelessWidget {

@override
Widget build(BuildContext context) {
return AppScaffold(
return const AppScaffold(
reverse: true,
title: 'Reverse Example',
slivers: [
Expand Down
14 changes: 7 additions & 7 deletions example/lib/examples/side_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class SideHeaderExample extends StatelessWidget {

@override
Widget build(BuildContext context) {
return AppScaffold(
return const AppScaffold(
title: 'Side Header Example',
slivers: [
_StickyHeaderGrid(index: 0),
Expand Down Expand Up @@ -38,15 +38,10 @@ class _StickyHeaderGrid extends StatelessWidget {
sliver: SliverPadding(
padding: const EdgeInsets.only(left: 60),
sliver: SliverGrid(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, crossAxisSpacing: 4.0, mainAxisSpacing: 4.0),
delegate: SliverChildBuilderDelegate(
(context, i) => GridTile(
child: Card(
child: Container(
color: Colors.green,
),
),
footer: Container(
color: Colors.white.withOpacity(0.5),
child: Padding(
Expand All @@ -57,6 +52,11 @@ class _StickyHeaderGrid extends StatelessWidget {
),
),
),
child: Card(
child: Container(
color: Colors.green,
),
),
),
childCount: 9,
),
Expand Down
Loading