import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/activity.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/item_title.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';

class ShortcutOperation extends StatefulWidget {
  final Function goToOrder;

  ShortcutOperation(this.goToOrder);

  @override
  State<StatefulWidget> createState() {
    return _ShortcutOperation();
  }
}

class _ShortcutOperation extends State<ShortcutOperation> {
  ApiService apiService;

  @override
  void initState() {
    super.initState();
  }


  @override
  Widget build(BuildContext context) {
    return Container(
      height: 150.h,
        margin: EdgeInsets.only(bottom:15),
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            GestureDetector(
              onTap: (){
                widget.goToOrder();
              },
              child: Container(
                width: 106,
                color: Colors.white,
                margin: EdgeInsets.only(right:10),
                padding: EdgeInsets.only(top: 8,bottom: 8),
                child: Column(
                  children: [
                    Text(
                      "现在下单",
                      style: TextStyle(
                        fontWeight: MyFontWeight.semi_bold,
                        fontSize: 15.sp,
                        color: Colors.black,
                      ),
                    ),
                    SizedBox(height: 5),
                    Text(
                      "美味等你来!",
                      style: TextStyle(
                        fontWeight: MyFontWeight.regular,
                        fontSize: 12.sp,
                        color: Colors.black,
                      ),
                    ),
                    SizedBox(height: 20),
                    Expanded(child: Image.asset(
                      "assets/image/home_order.png",
                      width:70,
                      height:70,
                    ),),
                  ],
                ),
              ),
            ),
            GestureDetector(
              onTap: (){
                Navigator.of(context).pushNamed('/router/recharge_page');
              },
              child:  Container(
                width: 106,
                color: Colors.white,
                margin: EdgeInsets.only(right:10),
                padding: EdgeInsets.only(top: 8,bottom: 8),
                child: Column(
                  children: [
                    Text(
                      "平台储值",
                      style: TextStyle(
                        fontWeight: MyFontWeight.semi_bold,
                        fontSize: 15.sp,
                        color: Colors.black,
                      ),
                    ),
                    SizedBox(height: 5),
                    Text(
                      "充值送会员!",
                      style: TextStyle(
                        fontWeight: MyFontWeight.regular,
                        fontSize: 12.sp,
                        color: Colors.black,
                      ),
                    ),
                    SizedBox(height: 20),
                    Expanded(child:Image.asset(
                      "assets/image/home_recharge.png",
                      width:70,
                      height:70,
                    ),),
                  ],
                ),
              ),
            ),
            GestureDetector(
              onTap: (){
                Navigator.of(context).pushNamed('/router/roll_center_page');
              },
              child:Container(
                width: 106,
                color: Colors.white,
                padding: EdgeInsets.only(top: 8,bottom: 8),
                child: Column(
                  children: [
                    Text(
                      "天天有劵",
                      style: TextStyle(
                        fontWeight: MyFontWeight.semi_bold,
                        fontSize: 15.sp,
                        color: Colors.black,
                      ),
                    ),
                    SizedBox(height: 5),
                    Text(
                      "来领超值好劵!",
                      style: TextStyle(
                        fontWeight: MyFontWeight.regular,
                        fontSize: 12.sp,
                        color: Colors.black,
                      ),
                    ),
                    SizedBox(height: 20),
                    Expanded(child:  Image.asset(
                      "assets/image/home_coupon.png",
                      width:70,
                      height:70,
                    ), ),

                  ],
                ),
              ),
            ),
          ],
        ),
      );
  }

}