lesson_card_item.dart 3.75 KB
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class LessonCardItem extends StatelessWidget {
  const LessonCardItem({super.key, required this.onTap});

  final Function() onTap;

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(10.r),
        color: Colors.blue,
        border: Border.all(
          width: 1.0,
          color: Colors.black
        )
        // image: DecorationImage(
        //   image: AssetImage(
        //     ''.assetPng,
        //   ),
        //   fit: BoxFit.fill
        // )
      ),
      padding: EdgeInsets.symmetric(horizontal: 16.w,vertical: 16.h),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Container(
            width: 124.w,
            decoration: BoxDecoration(
                border: Border.all(
                  width: 1.0,
                  color: const Color(0xFF333333),
                ),
                image: const DecorationImage(
                  fit: BoxFit.fill,
                  image: NetworkImage('https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2Faa1c2213-820a-4223-8757-5f8cee318a28%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1688713226&t=192b18a613683bcdc5bd76f65c9ff032'),
                )
            ),
          ),
          21.5.horizontalSpace,
          Expanded(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              crossAxisAlignment: CrossAxisAlignment.end,
              children: [
                Text(
                  'Wow English 课程年卡',
                  softWrap: true,
                  textAlign: TextAlign.left,
                  style: TextStyle(
                      fontSize: 12.sp,
                      color: const Color(0xFF333333)
                  ),
                ),
                RichText(
                  text: TextSpan(
                      children:[
                        TextSpan(
                            text: '¥',
                            style: TextStyle(
                              fontSize: 21.sp,
                              color: const Color(0xFFF51A1A),
                            )
                        ),
                        TextSpan(
                            text: '998',
                            style: TextStyle(
                              fontSize: 40.sp,
                              color: const Color(0xFFF51A1A),
                            ),
                        )
                      ]
                  ),
                ),
                GestureDetector(
                  onTap: () {
                    onTap();
                  },
                  child: Container(
                    decoration: BoxDecoration(
                        color: const Color(0xFFF5C51F),
                        borderRadius: BorderRadius.circular(5.r),
                        border: Border.all(
                          color: const Color(0xFF333333),
                          width: 1.0,
                        )
                    ),
                    padding: EdgeInsets.symmetric(
                      vertical: 1.h,
                      horizontal: 26.5.w,
                    ),
                    child: Text(
                      '立即购买',
                      style: TextStyle(
                          fontSize: 10.sp,
                          color: const Color(0xFF333333)
                      ),
                    ),
                  ),
                )
              ],
            ),
          )
        ],
      ),
    );
  }
}