import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:news_getx/modules/main/main_controller.dart';
import 'package:news_getx/modules/widgets/button.dart';
import 'package:news_getx/modules/widgets/input.dart';
import 'package:news_getx/modules/widgets/toast.dart';
import 'package:news_getx/theme/app_colors.dart';

/// 邮件订阅
class NewsLetterWidget extends GetView<MainController> {
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.all(20.w),
      child: Column(
        children: <Widget>[
          Row(
            children: <Widget>[
              Text(
                'Newsletter',
                style: TextStyle(
                  fontFamily: 'Montserrat',
                  fontSize: 18.sp,
                  fontWeight: FontWeight.w300,
                  color: AppColors.thirdElementText,
                ),
              ),
              Spacer(),
              IconButton(
                padding: EdgeInsets.zero,
                alignment: Alignment.centerRight,
                onPressed: () {},
                icon: Icon(
                  Icons.close,
                  color: AppColors.thirdElementText,
                  size: 18.sp,
                ),
              )
            ],
          ),
          // email
          inputEmailEdit(
            marginTop: 19,
            keyboardType: TextInputType.emailAddress,
            hintText: "Email",
            isPassword: false,
            controller: null,
          ),

          // btn subcrible
          Padding(
            padding: EdgeInsets.only(top: 15),
            child: FlatButton(
              onPressed: () {},
              width: 335.w,
              height: 44.h,
              fontWeight: FontWeight.w600,
              title: "Subscribe",
            ),
          ),

          // disc
          Container(
            margin: EdgeInsets.only(top: 29.h),
            width: 261.w,
            child: Text.rich(
              TextSpan(
                children: <TextSpan>[
                  TextSpan(
                    text: 'By clicking on Subscribe button you agree to accept',
                    style: TextStyle(
                      color: AppColors.thirdElementText,
                      fontFamily: "Avenir",
                      fontWeight: FontWeight.w400,
                      fontSize: 14.sp,
                    ),
                  ),
                  TextSpan(
                    text: ' Privacy Policy',
                    style: TextStyle(
                      color: AppColors.secondaryElementText,
                      fontFamily: "Avenir",
                      fontWeight: FontWeight.w400,
                      fontSize: 14.sp,
                    ),
                    recognizer: TapGestureRecognizer()
                      ..onTap = () {
                        toastInfo(msg: 'Privacy Policy');
                      },
                  ),
                ],
              ),
              textAlign: TextAlign.center,
            ),
          ),
        ],
      ),
    );
  }
}
