import 'package:flutter/material.dart'; /// Cyber/IT surface tokens. /// /// Cards use **tonal elevation** (color tints) plus a hairline outline instead /// of drop-shadows. The shape language is tightened to a precise 12–16 dp /// technical feel: standard cards 12 dp, compact items 10 dp, large containers /// 16 dp, dialogs/sheets 20 dp, and chips/badges 8 dp. @immutable class AppSurfaces extends ThemeExtension { const AppSurfaces({ required this.cardRadius, required this.compactCardRadius, required this.containerRadius, required this.dialogRadius, required this.chipRadius, }); /// Standard card radius – 12 dp (cyber/IT medium shape). final double cardRadius; /// Compact card radius for dense list tiles – 10 dp. final double compactCardRadius; /// Large container radius – 16 dp. final double containerRadius; /// Dialog / bottom-sheet radius – 20 dp. final double dialogRadius; /// Chip / badge radius – 8 dp. final double chipRadius; // convenience shapes RoundedRectangleBorder get standardShape => RoundedRectangleBorder(borderRadius: BorderRadius.circular(cardRadius)); RoundedRectangleBorder get compactShape => RoundedRectangleBorder( borderRadius: BorderRadius.circular(compactCardRadius), ); RoundedRectangleBorder get containerShape => RoundedRectangleBorder( borderRadius: BorderRadius.circular(containerRadius), ); RoundedRectangleBorder get dialogShape => RoundedRectangleBorder(borderRadius: BorderRadius.circular(dialogRadius)); static AppSurfaces of(BuildContext context) { final ext = Theme.of(context).extension(); return ext ?? const AppSurfaces( cardRadius: 12, compactCardRadius: 10, containerRadius: 16, dialogRadius: 20, chipRadius: 8, ); } @override AppSurfaces copyWith({ double? cardRadius, double? compactCardRadius, double? containerRadius, double? dialogRadius, double? chipRadius, }) { return AppSurfaces( cardRadius: cardRadius ?? this.cardRadius, compactCardRadius: compactCardRadius ?? this.compactCardRadius, containerRadius: containerRadius ?? this.containerRadius, dialogRadius: dialogRadius ?? this.dialogRadius, chipRadius: chipRadius ?? this.chipRadius, ); } @override AppSurfaces lerp(ThemeExtension? other, double t) { if (other is! AppSurfaces) return this; return AppSurfaces( cardRadius: _lerpDouble(cardRadius, other.cardRadius, t), compactCardRadius: _lerpDouble( compactCardRadius, other.compactCardRadius, t, ), containerRadius: _lerpDouble(containerRadius, other.containerRadius, t), dialogRadius: _lerpDouble(dialogRadius, other.dialogRadius, t), chipRadius: _lerpDouble(chipRadius, other.chipRadius, t), ); } } double _lerpDouble(double a, double b, double t) => a + (b - a) * t;