// Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
import 'package:wyatt_ui_kit/wyatt_ui_kit.dart';
import 'package:wyatt_ui_kit_example/theme/constants.dart';

class LoaderTheme extends LoaderThemeExtension {
  const LoaderTheme({
    super.colors,
    super.stroke,
  });

  factory LoaderTheme.light() => const LoaderTheme(
        colors: MultiColor([Constants.blue1, Constants.white]),
        stroke: 15,
      );

  factory LoaderTheme.dark() => const LoaderTheme(
        colors: MultiColor([Constants.blue2, Constants.grey2]),
        stroke: 15,
      );

  @override
  ThemeExtension<LoaderThemeExtension> copyWith({
    MultiColor? colors,
    double? stroke,
  }) =>
      LoaderTheme(
        colors: colors ?? this.colors,
        stroke: stroke ?? this.stroke,
      );

  @override
  ThemeExtension<LoaderThemeExtension> lerp(
    covariant ThemeExtension<LoaderThemeExtension>? other,
    double t,
  ) {
    if (other is! LoaderTheme) {
      return this;
    }
    return LoaderTheme(
      colors: MultiColor.lerp(colors, other.colors, t),
      stroke: lerpDouble(stroke, other.stroke, t),
    );
  }
}
