import 'package:flutter/material.dart';
import 'package:gz_video_player/video_speed.dart';

class VideoSpeedTip extends StatelessWidget {
  VideoSpeedTip({
    super.key,
    VideoSpeedTipStyle? videoSpeedTipStyle,
    this.speed = '1.0X',
    this.hidden = true,
  }) : videoSpeedTipStyle = videoSpeedTipStyle ?? VideoSpeedTipStyle();

  final VideoSpeedTipStyle videoSpeedTipStyle;
  final String speed;
  final bool hidden;

  @override
  Widget build(BuildContext context) {
    return Offstage(
      offstage: hidden,
      child: Align(
        alignment: videoSpeedTipStyle.alignment,
        child: Container(
          width: videoSpeedTipStyle.size.width,
          height: videoSpeedTipStyle.size.height,
          decoration: videoSpeedTipStyle.decoration,
          child: Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              videoSpeedTipStyle.icon,
              Padding(
                padding: videoSpeedTipStyle.middlePadding,
                child: Text(
                  speed,
                  style: videoSpeedTipStyle.speedTextStyle,
                ),
              ),
              Text(
                videoSpeedTipStyle.describe,
                style: videoSpeedTipStyle.describeTextStyle,
              ),
            ],
          ),
        ),
      ),
    );
  }
}
