Files
buzz/mobile/lib/shared/widgets/editor_option_button.dart
klopez4212 ed11c8d8bf Refresh mobile utility surfaces and theme picker (#6944)
## Summary

- invert mobile utility surfaces so pages and sheets use the softer page
background with raised containers
- rebuild the community theme picker around swipeable Home/Chat
previews, accent and appearance controls, and native iOS glass
interactions
- align shared sheet/profile spacing and radii, and move Theme into the
Community settings card

### Related issue

None found.

### Testing

- `just mobile-check`
- `just mobile-test` (1,871 tests)
- signed iOS Release build installed on a physical iPhone

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Signed-off-by: Kenny Lopez <klopez4212@gmail.com>
Signed-off-by: Princess Donut <b238ea756dee4d98afa5883fc7f1de61eeabe65bf700e3a5a5a80db5e42e2c2b@buzz.block.builderlab.xyz>
Co-authored-by: Princess Donut <b238ea756dee4d98afa5883fc7f1de61eeabe65bf700e3a5a5a80db5e42e2c2b@buzz.block.builderlab.xyz>
2026-08-28 18:56:42 +01:00

132 lines
3.5 KiB
Dart

import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../theme/theme.dart';
import 'ios_glass_navigation_button.dart';
/// A labelled circular mode option matching the profile editor controls.
class EditorOptionButton extends StatelessWidget {
const EditorOptionButton({
super.key,
required this.icon,
this.iosIcon,
required this.label,
required this.selected,
required this.onTap,
this.labelMaxWidth,
});
final IconData icon;
final IosGlassNavigationIcon? iosIcon;
final String label;
final bool selected;
final VoidCallback? onTap;
final double? labelMaxWidth;
@override
Widget build(BuildContext context) {
final handleTap = onTap == null
? null
: () {
unawaited(HapticFeedback.selectionClick());
onTap!();
};
Widget labelWidget() {
final style = context.textTheme.labelSmall?.copyWith(
color: selected
? context.colors.onSurface
: context.colors.onSurfaceVariant,
);
final width = labelMaxWidth;
if (width == null) {
return Text(
label,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: style,
);
}
return SizedBox(
height: 20,
child: OverflowBox(
maxWidth: width,
maxHeight: 20,
child: Text(
label,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: style,
),
),
);
}
if (defaultTargetPlatform == TargetPlatform.iOS && iosIcon != null) {
return Column(
children: [
IosGlassNavigationButton(
icon: iosIcon!,
semanticLabel: label,
onPressed: handleTap,
width: 64,
height: 64,
controlSize: 64,
foregroundColor: selected
? context.colors.primary
: context.colors.onSurface,
isSelected: selected,
),
const SizedBox(height: Grid.half),
ExcludeSemantics(child: labelWidget()),
],
);
}
return Semantics(
label: label,
button: true,
selected: selected,
enabled: handleTap != null,
onTap: handleTap,
child: ExcludeSemantics(
child: InkResponse(
radius: 34,
onTap: handleTap,
child: SizedBox(
width: double.infinity,
child: Column(
children: [
AnimatedContainer(
duration: MediaQuery.disableAnimationsOf(context)
? Duration.zero
: const Duration(milliseconds: 150),
curve: Curves.easeOutCubic,
width: 64,
height: 64,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: selected
? context.colors.onSurface
: context.colors.surfaceContainerHighest,
),
child: Icon(
icon,
size: 26,
color: selected
? context.colors.surface
: context.colors.onSurface,
),
),
const SizedBox(height: Grid.half),
labelWidget(),
],
),
),
),
),
);
}
}