123456789101112131415161718192021222324252627282930313233343536373839404142 |
-
- import 'package:flutter/material.dart';
- import 'package:flutter/widgets.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
-
- class PayItem extends StatelessWidget {
- String label;
- ImageProvider icon;
- Function() onPress;
-
- PayItem({Key? key, required this.label, required this.icon, required this.onPress }) : super(key: key);
-
- @override
- Widget build(BuildContext context) {
- return Padding(
- padding: EdgeInsets.fromLTRB(15.w, 0, 15.w, 0),
- child: ListTile(
- onTap: () {
- onPress();
- },
- contentPadding: const EdgeInsets.symmetric(horizontal: 0.0),
- // 这边使用了contentPadding
- leading: Image(
- image: icon,
- width: 30.w,
- height: 30.w,
- ),
- title: Transform(
- transform: Matrix4.translationValues(-15, 0.0, 0.0),
- child: Text(label,
- style: TextStyle(
- fontSize: 18.sp, color: const Color(0xff333333))),
- ),
- trailing: Image(
- image: const AssetImage('images/userRight.png'),
- width: 10.w,
- height: 18.w,
- ),
- ),
- );
- }
- }
|