import 'dart:math';

import 'package:get/get.dart' hide Rx;

import 'dart:ui' as ui show Image;

/// Created by Haoyi on 2022/7/16
///
///
// abstract class GemsController extends AdsController
//     with AssetsAware, InterstitialAware, RewardedAware, VisualFeastAware {
//   Future loadGemsResource(VisualFeastEngine engine) async {
//     final imageFutures = [
//       Flame.images.load("ic_gem.png"),
//       Flame.images.load("ic_gem_add.png"),
//     ];
//     final loadedResources = await Future.wait([
//       Future.wait(imageFutures),
//       // Future.wait(lottieFutures)
//     ]);
//     final images = loadedResources[0] as List<ui.Image>;
//     addSprite("gem", VisualFeastSprite.fromImage(images[0]));
//     addSprite("gemAdd", VisualFeastSprite.fromImage(images[1]));
//   }
//
//   void startClaim(int gems, String method, {bool useBg = true, VoidCallback? onCompleted}) async {
//     final engine = createEngine(onCompleted: onCompleted);
//     await loadGemsResource(engine);
//
//     final designSpec = GemsRewardsDesignSpec.get();
//     final gemsBarSpec = designSpec.buildGemBarSpec();
//     final gemsBar = GemsBar(
//         gemBarSpec: gemsBarSpec,
//         gemSprite: getSprite("gem"),
//         gemAddSprite: getSprite("gemAdd"),
//         assetsAware: this);
//     final size = designSpec.measuredSize / 2;
//     final gemsReward = GemsReward(
//         Rect.fromCenter(
//             center: Offset(size.width, size.height + gemsBarSpec.gemRect.width * 2),
//             width: gemsBarSpec.gemRect.width,
//             height: gemsBarSpec.gemRect.width), onFirstGemComplete: () {
//       claimGems(gems, method);
//     });
//     final background = Background(gemsBarSpec);
//     final gemsHeight = gemsBarSpec.gemRect.width;
//     final gemsText = GemsText(gems, Offset(size.width, size.height),
//         Offset(size.width, size.height - gemsHeight * 2));
//     engine.attachRenders(
//         ListUtils.filterOutNulls([useBg ? background : null, gemsBar, gemsReward, gemsText]));
//
//         dispatch(engine);
//   }
//
//   Future claimGems(int gems, String method) async {
//     onClaimed(gems, method);
//   }
//
//   void onClaimed(int gems, String method) {
//   }
// }
