Files
social-app/apps/lib/features/home/presentation/widgets/home_background_field.dart
T

80 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
import '../../../../core/theme/design_tokens.dart';
const homeBackgroundFieldKey = ValueKey('home_background_field');
class HomeBackgroundField extends StatelessWidget {
const HomeBackgroundField({super.key});
@override
Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
return DecoratedBox(
key: homeBackgroundFieldKey,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
colorScheme.surface,
colorScheme.surfaceContainerLow,
colorScheme.surface,
],
stops: const [0, 0.38, 1],
),
),
child: Stack(
fit: StackFit.expand,
children: [
Positioned(
top: -(AppSpacing.xxl * 2),
left: -(AppSpacing.xxl * 2),
child: _AmbientOrb(
color: colorScheme.primaryContainer.withValues(alpha: 0.55),
size: AppSpacing.xxl * 8,
),
),
Positioned(
right: -(AppSpacing.xxl * 2),
top: AppSpacing.xxl,
child: _AmbientOrb(
color: colorScheme.secondaryContainer.withValues(alpha: 0.42),
size: AppSpacing.xxl * 6,
),
),
],
),
);
}
}
class _AmbientOrb extends StatelessWidget {
const _AmbientOrb({required this.color, required this.size});
final Color color;
final double size;
@override
Widget build(BuildContext context) {
return IgnorePointer(
child: Container(
width: size,
height: size,
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: RadialGradient(
colors: [
color,
color.withValues(alpha: 0.12),
color.withValues(alpha: 0),
],
stops: const [0, 0.55, 1],
),
),
),
);
}
}