part of 'photo_main_page.dart';

class _BottomWidget extends StatefulWidget {

  final Options options;

  final SelectedProvider selectedProvider;

  final String galleryName;

  final VoidCallback onTapPreview;
  final VoidCallback onSend;

  const _BottomWidget(
      {Key key,
      this.options,
      this.selectedProvider,
      this.galleryName = "",
      this.onTapPreview,
      this.onSend})
      : super(key: key);

  @override
  __BottomWidgetState createState() => __BottomWidgetState();
}

class __BottomWidgetState extends State<_BottomWidget> {
  Options get options => widget.options;

  @override
  Widget build(BuildContext context) {
    var textStyle = TextStyle(fontSize: 14.0);
    const textPadding = const EdgeInsets.symmetric(horizontal: 16.0);

    var curCount = widget.selectedProvider.selectedCount;
    return Container(
      color: Colors.white,
      child: SafeArea(
        bottom: true,
        top: false,
        child: Container(
          height: 52.0,
          child: Row(
            children: <Widget>[
              FlatButton(
                onPressed: widget.onTapPreview,
                textColor: options.textColor,
                splashColor: Colors.transparent,
                disabledTextColor: options.disableColor,
                child: Container(
                  height: 44.0,
                  alignment: Alignment.center,
                  child: Text(
                    I18n.of(context).Preview,
                    style: textStyle,
                  ),
                  padding: textPadding,
                ),
              ),
              Expanded(
                child: Container(),
              ),
              InkWell(
                onTap: curCount > 0 ? widget.onSend : null,
                child: Container(
                  padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15),
                  margin: EdgeInsets.symmetric(vertical: 5, horizontal: 5),
                  decoration: BoxDecoration(
                      color:
                          curCount > 0 ? Color(0xFF2D81FF) : Color(0xFFC7C7C7),
                      borderRadius: BorderRadius.circular(8)),
                  child: Text(
                    "${I18n.of(context).determine}(${widget.selectedProvider.selectedCount})",
                    style: textStyle.copyWith(color: Colors.white),
                  ),
                ),
              )
            ],
          ),
        ),
      ),
    );
  }
}
