import 'package:flutter/widgets.dart';
import 'package:mnemo_cards_common/mnemo_cards_common.dart';

import '../../di/locator.dart';
import '../../utils/string_helper.dart';
import 'card_pack_header.dart';

class Loading extends StatelessWidget {
  final CardPackPreviewDto previewDto;

  Loading(this.previewDto);

  @override
  Widget build(BuildContext context) {
    final memoryImage = locator.imagesHolder.get('pack_${previewDto.id}');
    return Column(
      children: [
        CardPackHeader(
          previewDto.title,
          previewDto.subtitle,
          previewDto.color?.asColor,
        ),
        Expanded(
          child: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                if (memoryImage != null)
                  Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: Image(
                      image: memoryImage,
                      width: 100,
                    ),
                  ),
                Text('Загрузка...'),
              ],
            ),
          ),
        ),
      ],
    );
  }
}