mirror of
https://github.com/hiddify/hiddify-next.git
synced 2026-06-05 21:05:07 +08:00
31 lines
1007 B
Dart
31 lines
1007 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class ConnectionButtonTheme extends ThemeExtension<ConnectionButtonTheme> {
|
|
const ConnectionButtonTheme({this.idleColor, this.connectedColor});
|
|
|
|
final Color? idleColor;
|
|
final Color? connectedColor;
|
|
|
|
static const ConnectionButtonTheme light = ConnectionButtonTheme(
|
|
idleColor: Color(0xFF4a4d8b),
|
|
connectedColor: Color(0xFF44a334),
|
|
);
|
|
|
|
@override
|
|
ThemeExtension<ConnectionButtonTheme> copyWith({Color? idleColor, Color? connectedColor}) => ConnectionButtonTheme(
|
|
idleColor: idleColor ?? this.idleColor,
|
|
connectedColor: connectedColor ?? this.connectedColor,
|
|
);
|
|
|
|
@override
|
|
ThemeExtension<ConnectionButtonTheme> lerp(covariant ThemeExtension<ConnectionButtonTheme>? other, double t) {
|
|
if (other is! ConnectionButtonTheme) {
|
|
return this;
|
|
}
|
|
return ConnectionButtonTheme(
|
|
idleColor: Color.lerp(idleColor, other.idleColor, t),
|
|
connectedColor: Color.lerp(connectedColor, other.connectedColor, t),
|
|
);
|
|
}
|
|
}
|