Skip to content

Commit

Permalink
[FIX] FABの位置ズレ (#706)
Browse files Browse the repository at this point in the history
fix: FAB
  • Loading branch information
YumNumm authored May 30, 2024
1 parent 87121b3 commit f2869d2
Show file tree
Hide file tree
Showing 3 changed files with 170 additions and 175 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,94 +92,89 @@ class EarthquakeHistoryDetailsPage extends HookConsumerWidget {
registerNavigateToHome: (func) =>
navigateToHomeFunction.value = func,
),

if (maxIntensity != null)
IgnorePointer(
child: SafeArea(
child: Align(
alignment: Alignment.topRight,
child: Padding(
padding: const EdgeInsets.all(8),
child: AnimatedSwitcher(
duration: const Duration(milliseconds: 250),
child: BorderedContainer(
key: ValueKey(
(config, maxIntensity, maxLgIntensity),
),
margin: const EdgeInsets.all(4),
padding: const EdgeInsets.all(4),
borderRadius: BorderRadius.circular((25 / 5) + 5),
child: Wrap(
spacing: 8,
runSpacing: 8,
children: [
if (config.showingLpgmIntensity &&
maxLgIntensity != null)
for (final intensity in [
...JmaLgIntensity.values,
].where(
(e) =>
e != JmaLgIntensity.zero &&
e <= maxLgIntensity,
))
JmaLgIntensityIcon(
type: IntensityIconType.filled,
intensity: intensity,
size: 25,
)
else
for (final intensity in [
...JmaIntensity.values,
].where(
(e) => e <= maxIntensity,
))
JmaIntensityIcon(
type: IntensityIconType.filled,
intensity: intensity,
size: 25,
),
],
),
),
),
),
),
),
),
SheetFloatingActionButtons(
hasAppBar: false,
controller: sheetController,
fab: [
Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
Column(
children: [
if (maxIntensity != null)
Expanded(
child: Container(
alignment: Alignment.centerLeft,
child: IgnorePointer(
child: AnimatedSwitcher(
duration: const Duration(milliseconds: 250),
child: BorderedContainer(
key: ValueKey(
(config, maxIntensity, maxLgIntensity),
),
margin: const EdgeInsets.all(4),
padding: const EdgeInsets.all(4),
borderRadius: BorderRadius.circular((25 / 5) + 5),
child: Wrap(
spacing: 8,
runSpacing: 8,
children: [
if (config.showingLpgmIntensity &&
maxLgIntensity != null)
for (final intensity in [
...JmaLgIntensity.values,
].where(
(e) =>
e != JmaLgIntensity.zero &&
e <= maxLgIntensity,
))
JmaLgIntensityIcon(
type: IntensityIconType.filled,
intensity: intensity,
size: 25,
)
else
for (final intensity in [
...JmaIntensity.values,
].where(
(e) => e <= maxIntensity,
))
JmaIntensityIcon(
type: IntensityIconType.filled,
intensity: intensity,
size: 25,
),
],
),
),
),
),
),
)
else
const Spacer(),
Column(
children: [
// layer controller
if (details.maxIntensity != null)
FloatingActionButton.small(
heroTag: 'earthquake_history_details_layer_fab',
tooltip: '地図の表示レイヤーを切り替える',
onPressed: () =>
showEarthquakeHistoryDetailConfigDialog(
context,
showCitySelector: details.intensityCities != null,
hasLpgmIntensity: details.maxLpgmIntensity != null,
),
elevation: 4,
child: const Icon(Icons.layers),
),
FloatingActionButton.small(
heroTag: 'earthquake_history_details_fab',
tooltip: '表示領域を地図に合わせる',
onPressed: () {
if (navigateToHomeFunction.value != null) {
navigateToHomeFunction.value!.call();
}
},
elevation: 4,
child: const Icon(Icons.home),
// layer controller
if (details.maxIntensity != null)
FloatingActionButton.small(
heroTag: 'earthquake_history_details_layer_fab',
tooltip: '地図の表示レイヤーを切り替える',
onPressed: () => showEarthquakeHistoryDetailConfigDialog(
context,
showCitySelector: details.intensityCities != null,
hasLpgmIntensity: details.maxLpgmIntensity != null,
),
],
elevation: 4,
child: const Icon(Icons.layers),
),
FloatingActionButton.small(
heroTag: 'earthquake_history_details_fab',
tooltip: '表示領域を地図に合わせる',
onPressed: () {
if (navigateToHomeFunction.value != null) {
navigateToHomeFunction.value!.call();
}
},
elevation: 4,
child: const Icon(Icons.home),
),
],
),
Expand All @@ -192,25 +187,21 @@ class EarthquakeHistoryDetailsPage extends HookConsumerWidget {
),
if (Navigator.canPop(context))
// 戻るボタン
Positioned(
top: 0,
left: 0,
child: SafeArea(
child: IconButton.filledTonal(
style: ButtonStyle(
shape: MaterialStatePropertyAll(
RoundedRectangleBorder(
side: BorderSide(
color: colorScheme.primary.withOpacity(0.2),
),
borderRadius: BorderRadius.circular(128),
SafeArea(
child: IconButton.filledTonal(
style: ButtonStyle(
shape: MaterialStatePropertyAll(
RoundedRectangleBorder(
side: BorderSide(
color: colorScheme.primary.withOpacity(0.2),
),
borderRadius: BorderRadius.circular(128),
),
),
icon: const Icon(Icons.arrow_back),
onPressed: () => context.pop(),
color: colorScheme.primary,
),
icon: const Icon(Icons.arrow_back),
onPressed: () => context.pop(),
color: colorScheme.primary,
),
),
],
Expand Down
147 changes: 75 additions & 72 deletions app/lib/feature/home/component/sheet/status_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,86 +69,89 @@ class SheetStatusWidget extends ConsumerWidget {
// kmoni
if (useKmoni)
Expanded(
child: InkWell(
borderRadius: BorderRadius.circular(8),
onTap: adjustKmoniDelay,
child: Padding(
padding: const EdgeInsets.all(2),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
// 現在時刻
...switch (status) {
KmoniStatus.stopped => [
const Icon(
Icons.access_time_rounded,
size: 16,
),
const SizedBox(width: 4),
Flexible(
child: Text(
'強震モニタ 停止中',
style: theme.textTheme.bodyMedium,
child: Tooltip(
message: '強震モニタ遅延調整',
child: InkWell(
borderRadius: BorderRadius.circular(8),
onTap: adjustKmoniDelay,
child: Padding(
padding: const EdgeInsets.all(2),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
// 現在時刻
...switch (status) {
KmoniStatus.stopped => [
const Icon(
Icons.access_time_rounded,
size: 16,
),
),
],
_ when isDelayAdjusting && latestTime != null => [
Flexible(
child: Text(
DateFormat('yyyy/MM/dd HH:mm:ss')
.format(latestTime),
style: theme.textTheme.bodyMedium!.copyWith(
fontFamily: monoFont,
letterSpacing: -0.2,
const SizedBox(width: 4),
Flexible(
child: Text(
'強震モニタ 停止中',
style: theme.textTheme.bodyMedium,
),
),
),
const SizedBox(width: 8),
const SizedBox(
height: 20,
width: 20,
child: CircularProgressIndicator.adaptive(),
),
],
_
when isInitialized &&
latestTime != null &&
status == KmoniStatus.delay =>
[
Flexible(
child: Text(
DateFormat('yyyy/MM/dd HH:mm:ss')
.format(latestTime),
style: theme.textTheme.bodyMedium!.copyWith(
fontFamily: monoFont,
color: Colors.redAccent,
letterSpacing: -0.2,
],
_ when isDelayAdjusting && latestTime != null => [
Flexible(
child: Text(
DateFormat('yyyy/MM/dd HH:mm:ss')
.format(latestTime),
style: theme.textTheme.bodyMedium!.copyWith(
fontFamily: monoFont,
letterSpacing: -0.2,
),
),
),
),
],
_ when isInitialized && latestTime != null => [
Flexible(
child: Text(
DateFormat('yyyy/MM/dd HH:mm:ss').format(
latestTime,
const SizedBox(width: 8),
const SizedBox(
height: 20,
width: 20,
child: CircularProgressIndicator.adaptive(),
),
],
_
when isInitialized &&
latestTime != null &&
status == KmoniStatus.delay =>
[
Flexible(
child: Text(
DateFormat('yyyy/MM/dd HH:mm:ss')
.format(latestTime),
style: theme.textTheme.bodyMedium!.copyWith(
fontFamily: monoFont,
color: Colors.redAccent,
letterSpacing: -0.2,
),
),
style: theme.textTheme.bodyMedium!.copyWith(
fontFamily: monoFont,
letterSpacing: -0.2,
),
],
_ when isInitialized && latestTime != null => [
Flexible(
child: Text(
DateFormat('yyyy/MM/dd HH:mm:ss').format(
latestTime,
),
style: theme.textTheme.bodyMedium!.copyWith(
fontFamily: monoFont,
letterSpacing: -0.2,
),
),
),
),
],
_ => [
const SizedBox(
height: 20,
width: 20,
child: CircularProgressIndicator.adaptive(),
),
],
},
],
],
_ => [
const SizedBox(
height: 20,
width: 20,
child: CircularProgressIndicator.adaptive(),
),
],
},
],
),
),
),
),
Expand Down
13 changes: 7 additions & 6 deletions app/lib/feature/home/view/home_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,6 @@ class _HomeBodyWidget extends HookConsumerWidget {
bottom: false,
child: Stack(
children: [
SheetFloatingActionButtons(
controller: sheetController,
fab: const [
_Fabs(),
],
),
// Sheet
const Align(
alignment: Alignment.topRight,
Expand All @@ -285,6 +279,13 @@ class _HomeBodyWidget extends HookConsumerWidget {
],
),
),
SheetFloatingActionButtons(
hasAppBar: false,
controller: sheetController,
fab: const [
_Fabs(),
],
),
],
);
return child;
Expand Down

0 comments on commit f2869d2

Please sign in to comment.