|
|
|
import 'dart:ui';
|
|
|
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/widgets.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
|
|
|
class ItemTitle extends StatelessWidget {
|
|
|
|
final String text;
|
|
|
|
final String imgPath;
|
|
|
|
final int moreType;
|
|
|
|
|
|
|
|
final String moreText;
|
|
|
|
final List<DropdownMenuItem<String>> items;
|
|
|
|
|
|
|
|
ItemTitle({
|
|
|
|
this.text,
|
|
|
|
this.imgPath = "",
|
|
|
|
this.moreText = "",
|
|
|
|
this.moreType = 0,
|
|
|
|
this.items,
|
|
|
|
this.onChanged,
|
|
|
|
this.onTap,
|
|
|
|
});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
left: 16.w,
|
|
|
|
right: 17.w,
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
text,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF0D0D0D),
|
|
|
|
fontSize: 15.sp,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 8.w,
|
|
|
|
),
|
|
|
|
if(imgPath != "")
|
|
|
|
Image.asset(
|
|
|
|
imgPath,
|
|
|
|
width: 24.w,
|
|
|
|
height: 24.h,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
if (moreText != "") buildMore()
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
final GestureTapCallback onTap;
|
|
|
|
final Function(String) onChanged;
|
|
|
|
|
|
|
|
Widget buildMore() {
|
|
|
|
return moreType == 0
|
|
|
|
? GestureDetector(
|
|
|
|
onTap: onTap,
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: 8.w,
|
|
|
|
right: 8.w,
|
|
|
|
top: 2.h,
|
|
|
|
bottom: 2.h,
|
|
|
|
),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Colors.black.withAlpha(25),
|
|
|
|
offset: Offset(0, 1),
|
|
|
|
blurRadius: 12,
|
|
|
|
spreadRadius: 0,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
moreText,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Icon(
|
|
|
|
moreType == 0
|
|
|
|
? Icons.keyboard_arrow_right
|
|
|
|
: Icons.keyboard_arrow_down,
|
|
|
|
size: 16,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Container(
|
|
|
|
padding: EdgeInsets.only(left: 10.w, right: 10.w),
|
|
|
|
child: DropdownButton(
|
|
|
|
items: items,
|
|
|
|
value: moreText,
|
|
|
|
onChanged: onChanged,
|
|
|
|
underline: Container(color: Colors.transparent),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|