Skip to content

Commit

Permalink
Fix floating button position on the home screen
Browse files Browse the repository at this point in the history
  • Loading branch information
tsutsu3 committed Jan 18, 2025
1 parent 0dbdb24 commit 4d4ed82
Showing 1 changed file with 60 additions and 50 deletions.
110 changes: 60 additions & 50 deletions lib/screens/home/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -219,63 +219,73 @@ class _HomeState extends State<Home> {
? Stack(
children: [
Scaffold(
body: NestedScrollView(
headerSliverBuilder:
(BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(
context,
body: SafeArea(
child: NestedScrollView(

Check warning on line 223 in lib/screens/home/home.dart

View check run for this annotation

Codecov / codecov/patch

lib/screens/home/home.dart#L222-L223

Added lines #L222 - L223 were not covered by tests
headerSliverBuilder:
(BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverOverlapAbsorber(

Check warning on line 227 in lib/screens/home/home.dart

View check run for this annotation

Codecov / codecov/patch

lib/screens/home/home.dart#L225-L227

Added lines #L225 - L227 were not covered by tests
handle:
NestedScrollView.sliverOverlapAbsorberHandleFor(

Check warning on line 229 in lib/screens/home/home.dart

View check run for this annotation

Codecov / codecov/patch

lib/screens/home/home.dart#L229

Added line #L229 was not covered by tests
context,
),
sliver: HomeAppBar(

Check warning on line 232 in lib/screens/home/home.dart

View check run for this annotation

Codecov / codecov/patch

lib/screens/home/home.dart#L232

Added line #L232 was not covered by tests
innerBoxIsScrolled: innerBoxIsScrolled,
),
),
sliver: HomeAppBar(
innerBoxIsScrolled: innerBoxIsScrolled,
),
),
];
},
body: SafeArea(
top: false,
bottom: false,
child: Builder(
builder: (context) => RefreshIndicator(
edgeOffset: 70,
onRefresh: () async {
await refreshServerStatus(context);
},
child: CustomScrollView(
slivers: [
SliverOverlapInjector(
handle: NestedScrollView
.sliverOverlapAbsorberHandleFor(context),
),
SliverList.list(
children: [
tiles(),
const SizedBox(height: 24),
const HomeCharts(),
const SizedBox(height: 16),
],
),
],
];
},
body: SafeArea(

Check warning on line 238 in lib/screens/home/home.dart

View check run for this annotation

Codecov / codecov/patch

lib/screens/home/home.dart#L238

Added line #L238 was not covered by tests
top: false,
bottom: false,
child: Builder(
builder: (context) => RefreshIndicator(

Check warning on line 242 in lib/screens/home/home.dart

View check run for this annotation

Codecov / codecov/patch

lib/screens/home/home.dart#L241-L242

Added lines #L241 - L242 were not covered by tests
edgeOffset: 70,
onRefresh: () async {
await refreshServerStatus(context);

Check warning on line 245 in lib/screens/home/home.dart

View check run for this annotation

Codecov / codecov/patch

lib/screens/home/home.dart#L244-L245

Added lines #L244 - L245 were not covered by tests
},
child: CustomScrollView(
slivers: [
SliverOverlapInjector(

Check warning on line 249 in lib/screens/home/home.dart

View check run for this annotation

Codecov / codecov/patch

lib/screens/home/home.dart#L247-L249

Added lines #L247 - L249 were not covered by tests
handle: NestedScrollView
.sliverOverlapAbsorberHandleFor(context),

Check warning on line 251 in lib/screens/home/home.dart

View check run for this annotation

Codecov / codecov/patch

lib/screens/home/home.dart#L251

Added line #L251 was not covered by tests
),
SliverList.list(
children: [
tiles(),

Check warning on line 255 in lib/screens/home/home.dart

View check run for this annotation

Codecov / codecov/patch

lib/screens/home/home.dart#L253-L255

Added lines #L253 - L255 were not covered by tests
const SizedBox(height: 24),
const HomeCharts(),
const SizedBox(height: 16),
],
),
],
),
),
),
),
),
),
),
AnimatedPositioned(
duration: const Duration(milliseconds: 100),
curve: Curves.easeInOut,
bottom: isVisible &&
statusProvider.getStatusLoading == LoadStatus.loaded
? appConfigProvider.showingSnackbar
? 70
: 20
: -70,
right: 20,
child: FloatingActionButton(
onPressed: enableDisableServer,
child: const Icon(Icons.shield_rounded),
SafeArea(
child: Stack(
children: [
AnimatedPositioned(

Check warning on line 272 in lib/screens/home/home.dart

View check run for this annotation

Codecov / codecov/patch

lib/screens/home/home.dart#L269-L272

Added lines #L269 - L272 were not covered by tests
duration: const Duration(milliseconds: 100),
curve: Curves.easeInOut,
bottom: isVisible &&
statusProvider.getStatusLoading ==

Check warning on line 276 in lib/screens/home/home.dart

View check run for this annotation

Codecov / codecov/patch

lib/screens/home/home.dart#L275-L276

Added lines #L275 - L276 were not covered by tests
LoadStatus.loaded
? appConfigProvider.showingSnackbar

Check warning on line 278 in lib/screens/home/home.dart

View check run for this annotation

Codecov / codecov/patch

lib/screens/home/home.dart#L278

Added line #L278 was not covered by tests
? 70
: 20
: -70,
right: 20,
child: FloatingActionButton(

Check warning on line 283 in lib/screens/home/home.dart

View check run for this annotation

Codecov / codecov/patch

lib/screens/home/home.dart#L283

Added line #L283 was not covered by tests
onPressed: enableDisableServer,
child: const Icon(Icons.shield_rounded),
),
),
],
),
),
],
Expand Down

0 comments on commit 4d4ed82

Please sign in to comment.