feat: responsive

This commit is contained in:
louis 2024-04-01 17:35:34 +08:00
parent 3022b3fb49
commit 82285026fe
10 changed files with 258 additions and 123 deletions

View File

@ -92,6 +92,10 @@ final theme = ThemeData(
border: border:
Border(bottom: BorderSide(width: 3, color: AppTheme.primaryColorDark)), Border(bottom: BorderSide(width: 3, color: AppTheme.primaryColorDark)),
)), )),
textSelectionTheme: const TextSelectionThemeData(
selectionHandleColor: AppTheme.primaryColorLight,
cursorColor: AppTheme.primaryColorLight, //
),
appBarTheme: AppBarTheme( appBarTheme: AppBarTheme(
centerTitle: true, centerTitle: true,
iconTheme: const IconThemeData(color: Colors.white), iconTheme: const IconThemeData(color: Colors.white),

View File

@ -0,0 +1,28 @@
import 'package:get/get_rx/src/rx_types/rx_types.dart';
class SaleQuotationModel {
final String name;
RxBool isExpanded = true.obs;
List<SaleQuotationItemModel> items;
SaleQuotationModel({required this.name, required this.items});
}
class SaleQuotationItemModel {
final String name;
//
final String? spec;
final String? unit;
final String? remark;
//
final double cost;
final int quantity;
final double amount;
SaleQuotationItemModel(
{required this.name,
this.spec,
this.unit,
this.remark,
this.cost = 0,
this.quantity = 0,
this.amount = 0});
}

View File

@ -165,7 +165,7 @@ class InventoryInoutCard extends StatelessWidget {
child: Text( child: Text(
textInOut, textInOut,
style: TextStyle( style: TextStyle(
fontSize: ScreenAdaper.sp(25), fontSize: ScreenAdaper.height(25),
color: AppTheme.nearlyWhite, color: AppTheme.nearlyWhite,
fontWeight: FontWeight.w600), fontWeight: FontWeight.w600),
), ),

View File

@ -406,7 +406,7 @@ class InventorySearch extends StatelessWidget {
child: Row(children: [ child: Row(children: [
Text( Text(
'${itemData.inventoryNumber}', '${itemData.inventoryNumber}',
style: TextStyle(fontSize: ScreenAdaper.sp(40)), style: TextStyle(fontSize: ScreenAdaper.height(30)),
), ),
SizedBox( SizedBox(
width: ScreenAdaper.width(10), width: ScreenAdaper.width(10),
@ -416,26 +416,29 @@ class InventorySearch extends StatelessWidget {
children: [ children: [
Text( Text(
'${itemData.product?.name}${itemData.product?.productSpecification != '' ? '(${itemData.product?.productSpecification})' : ''}', '${itemData.product?.name}${itemData.product?.productSpecification != '' ? '(${itemData.product?.productSpecification})' : ''}',
style: TextStyle(fontSize: ScreenAdaper.sp(40)), style: TextStyle(fontSize: ScreenAdaper.height(30)),
), ),
Text( Text(
'${itemData.product?.company?.name}', '${itemData.product?.company?.name}',
style: TextStyle( style: TextStyle(
fontSize: ScreenAdaper.sp(30), color: AppTheme.grey), fontSize: ScreenAdaper.height(30),
color: AppTheme.grey),
), ),
Text( Text(
'${itemData.project?.name}', '${itemData.project?.name}',
style: TextStyle( style: TextStyle(
fontSize: ScreenAdaper.sp(30), color: AppTheme.grey), fontSize: ScreenAdaper.height(30),
color: AppTheme.grey),
), ),
Text('${double.parse('${itemData.unitPrice}')}', Text('${double.parse('${itemData.unitPrice}')}',
style: TextStyle( style: TextStyle(
fontSize: ScreenAdaper.sp(30), color: AppTheme.grey)) fontSize: ScreenAdaper.height(30),
color: AppTheme.grey))
], ],
), ),
const Spacer(), const Spacer(),
Text('${itemData.quantity}${itemData.product?.unit?.label ?? ''}', Text('${itemData.quantity}${itemData.product?.unit?.label ?? ''}',
style: TextStyle(fontSize: ScreenAdaper.sp(40))), style: TextStyle(fontSize: ScreenAdaper.height(30))),
]), ]),
); );
}, },

View File

@ -0,0 +1,45 @@
import 'package:get/get.dart';
import 'package:sk_base_mobile/models/sale_quotation.model.dart';
class SaleQuotationController extends GetxController {
static SaleQuotationController get to => Get.find();
final RxList editingcell = RxList([null, null, null]);
RxList<SaleQuotationItemModel> products = RxList([
SaleQuotationItemModel(name: '矿用本安型支架控制器', unit: '', spec: 'ZDYZ-Z'),
SaleQuotationItemModel(name: '矿用本安型电磁阀驱动器'),
SaleQuotationItemModel(name: '矿用隔爆兼本安型电源'),
SaleQuotationItemModel(name: '矿用本安型隔离耦合器'),
SaleQuotationItemModel(name: '钢丝编织橡胶护套连接器'),
SaleQuotationItemModel(name: '钢丝编织橡胶护套连接器', remark: '控制器-控制器'),
SaleQuotationItemModel(name: '钢丝编织橡胶护套连接器', remark: '控制器-驱动器'),
SaleQuotationItemModel(name: '钢丝编织橡胶护套连接器', remark: '控制器-隔离耦合器'),
SaleQuotationItemModel(name: '矿用本安型支架无线遥控器'),
SaleQuotationItemModel(name: '矿用隔爆兼本安型电源'),
SaleQuotationItemModel(name: '电液换向阀(10功能10接口)', remark: '中间过渡架主阀组'),
SaleQuotationItemModel(name: '电液换向阀(20功能20接口)', remark: '端头架主阀组'),
SaleQuotationItemModel(name: '自动反冲洗过滤装置', remark: '流量:900L/min,过滤精度25μm'),
SaleQuotationItemModel(name: '全自动反冲洗过滤器电缆', remark: '控制器-自动反冲洗'),
SaleQuotationItemModel(name: '矿用本安型位移传感器'),
SaleQuotationItemModel(name: '矿用本安型压力传感器'),
SaleQuotationItemModel(name: '矿用本安型红外发射器'),
SaleQuotationItemModel(name: '矿用本安型LED信号灯'),
SaleQuotationItemModel(name: '倾角传感器'),
SaleQuotationItemModel(name: '各类安装附件'),
]);
RxList<SaleQuotationModel> groups = RxList<SaleQuotationModel>([]);
@override
void onReady() {
groups.assignAll([
SaleQuotationModel(name: '中间过渡架电控部分', items: products),
SaleQuotationModel(name: '端头架电控部分', items: products),
SaleQuotationModel(name: '主阀部分', items: products),
SaleQuotationModel(name: '自动反冲洗过滤器部分', items: products),
SaleQuotationModel(name: '位移测量部分', items: products),
SaleQuotationModel(name: '压力检测部分', items: products),
SaleQuotationModel(name: '煤机定位部分', items: products),
SaleQuotationModel(name: '姿态检测部分', items: products),
]);
super.onReady();
}
}

View File

@ -1,12 +1,15 @@
import 'dart:math';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:date_format/date_format.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:sk_base_mobile/app_theme.dart'; import 'package:sk_base_mobile/app_theme.dart';
import 'package:sk_base_mobile/models/sale_quotation.model.dart';
import 'package:sk_base_mobile/screens/sale_quotation/sale_quotation.controller.dart';
import 'package:sk_base_mobile/util/modal.util.dart'; import 'package:sk_base_mobile/util/modal.util.dart';
import 'package:sk_base_mobile/util/screen_adaper_util.dart'; import 'package:sk_base_mobile/util/screen_adaper_util.dart';
import 'package:sk_base_mobile/widgets/core/sk_number_input.dart';
import 'package:sk_base_mobile/widgets/core/sk_text_input.dart';
import 'package:sk_base_mobile/widgets/sk_appbar.dart'; import 'package:sk_base_mobile/widgets/sk_appbar.dart';
import 'package:flutter_sticky_header/flutter_sticky_header.dart'; import 'package:flutter_sticky_header/flutter_sticky_header.dart';
@ -17,10 +20,11 @@ class SaleQuotationPage extends StatelessWidget {
final unitPriceWidth = 80.0; final unitPriceWidth = 80.0;
final amountWidth = 85.0; final amountWidth = 85.0;
final headerTitleStyle = TextStyle( final headerTitleStyle = TextStyle(
fontSize: ScreenAdaper.sp(40), fontSize: ScreenAdaper.height(30),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: AppTheme.nearlyBlack); color: AppTheme.nearlyBlack);
final headerBgcolor = Color.fromARGB(255, 238, 238, 238); final headerBgcolor = Color.fromARGB(255, 238, 238, 238);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -36,7 +40,7 @@ class SaleQuotationPage extends StatelessWidget {
'添加组', '添加组',
style: TextStyle( style: TextStyle(
color: AppTheme.white, color: AppTheme.white,
fontSize: ScreenAdaper.sp(35), fontSize: ScreenAdaper.height(25),
fontWeight: FontWeight.w600), fontWeight: FontWeight.w600),
) )
], ],
@ -106,11 +110,11 @@ class SaleQuotationPage extends StatelessWidget {
Widget buildBody(SaleQuotationModel group, int index) { Widget buildBody(SaleQuotationModel group, int index) {
final titleStyle = TextStyle( final titleStyle = TextStyle(
fontSize: ScreenAdaper.sp(40), fontSize: ScreenAdaper.height(30),
color: AppTheme.nearlyBlack, color: AppTheme.nearlyBlack,
fontWeight: FontWeight.w600); fontWeight: FontWeight.w600);
final subTextStyle = final subTextStyle =
TextStyle(color: AppTheme.grey, fontSize: ScreenAdaper.sp(30)); TextStyle(color: AppTheme.grey, fontSize: ScreenAdaper.height(30));
return SliverStickyHeader.builder( return SliverStickyHeader.builder(
builder: (context, state) => Container( builder: (context, state) => Container(
@ -174,7 +178,7 @@ class SaleQuotationPage extends StatelessWidget {
)) ))
: SliverList( : SliverList(
delegate: SliverChildBuilderDelegate( delegate: SliverChildBuilderDelegate(
(context, i) => Slidable( (context, int i) => Slidable(
key: UniqueKey(), key: UniqueKey(),
endActionPane: ActionPane( endActionPane: ActionPane(
extentRatio: 0.2, extentRatio: 0.2,
@ -215,9 +219,10 @@ class SaleQuotationPage extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
'${group.items[i].name}', group.items[i].name,
style: TextStyle( style: TextStyle(
fontSize: ScreenAdaper.sp(35)), fontWeight: FontWeight.w600,
fontSize: ScreenAdaper.height(30)),
), ),
), ),
], ],
@ -230,7 +235,7 @@ class SaleQuotationPage extends StatelessWidget {
style: subTextStyle, style: subTextStyle,
), ),
Text( Text(
'${group.items[i].spec ?? ''}', group.items[i].spec ?? '',
style: subTextStyle, style: subTextStyle,
), ),
], ],
@ -243,7 +248,7 @@ class SaleQuotationPage extends StatelessWidget {
style: subTextStyle, style: subTextStyle,
), ),
Text( Text(
'${group.items[i].unit ?? ''}', group.items[i].unit ?? '',
style: subTextStyle, style: subTextStyle,
), ),
], ],
@ -268,21 +273,42 @@ class SaleQuotationPage extends StatelessWidget {
), ),
), ),
VerticalDivider(), VerticalDivider(),
buildEditCell(
Container( Container(
alignment: Alignment.center, alignment: Alignment.center,
width: quantityWidth, width: quantityWidth,
child: Text('13500'), child: Text(
'${controller.groups[index].items[i].quantity}'),
), ),
groupIndex: index,
rowIndex: i,
field: 'quantity',
inputWidth: quantityWidth,
value: controller.groups[index].items[i].quantity),
buildEditCell(
Container( Container(
alignment: Alignment.center, alignment: Alignment.center,
width: unitPriceWidth, width: unitPriceWidth,
child: Text('¥470000'), child: Text(
'${controller.groups[index].items[i].cost}'),
), ),
groupIndex: index,
rowIndex: i,
field: 'cost',
inputWidth: unitPriceWidth,
value: controller.groups[index].items[i].cost),
buildEditCell(
Container( Container(
alignment: Alignment.center, alignment: Alignment.center,
width: amountWidth, width: amountWidth,
child: Text('¥63450000'), child: Text(
'${controller.groups[index].items[i].amount}'),
), ),
groupIndex: index,
rowIndex: i,
field: 'amount',
inputWidth: amountWidth,
value: controller.groups[index].items[i].amount),
], ],
), ),
), ),
@ -294,66 +320,32 @@ class SaleQuotationPage extends StatelessWidget {
)), )),
); );
} }
}
class SaleQuotationModel { Widget buildEditCell(Widget content,
final String name; {required int groupIndex,
RxBool isExpanded = true.obs; required int rowIndex,
List<SaleQuotationItemModel> items; required String field,
SaleQuotationModel({required this.name, required this.items}); required double inputWidth,
} required dynamic value}) {
return Obx(() => controller.editingcell[0] == groupIndex &&
class SaleQuotationItemModel { controller.editingcell[1] == rowIndex &&
final String name; controller.editingcell[2] == field
// ? Container(
final String? spec; width: inputWidth,
final String? unit; child: SkNumberInput(
final String? remark; hint: '',
// isDense: true,
final double? cost; autoFocus: true,
SaleQuotationItemModel( contentPadding: EdgeInsets.symmetric(
{required this.name, this.spec, this.unit, this.remark, this.cost}); horizontal: ScreenAdaper.width(20),
} vertical: ScreenAdaper.height(10)),
textController: TextEditingController(text: '${value}')),
class SaleQuotationController extends GetxController { )
static SaleQuotationController get to => Get.find(); : InkWell(
onTap: () {
RxList<SaleQuotationItemModel> products = RxList([ controller.editingcell.value = [groupIndex, rowIndex, field];
SaleQuotationItemModel(name: '矿用本安型支架控制器', unit: '', spec: 'ZDYZ-Z'), },
SaleQuotationItemModel(name: '矿用本安型电磁阀驱动器'), child: content,
SaleQuotationItemModel(name: '矿用隔爆兼本安型电源'), ));
SaleQuotationItemModel(name: '矿用本安型隔离耦合器'),
SaleQuotationItemModel(name: '钢丝编织橡胶护套连接器'),
SaleQuotationItemModel(name: '钢丝编织橡胶护套连接器', remark: '控制器-控制器'),
SaleQuotationItemModel(name: '钢丝编织橡胶护套连接器', remark: '控制器-驱动器'),
SaleQuotationItemModel(name: '钢丝编织橡胶护套连接器', remark: '控制器-隔离耦合器'),
SaleQuotationItemModel(name: '矿用本安型支架无线遥控器'),
SaleQuotationItemModel(name: '矿用隔爆兼本安型电源'),
SaleQuotationItemModel(name: '电液换向阀(10功能10接口)', remark: '中间过渡架主阀组'),
SaleQuotationItemModel(name: '电液换向阀(20功能20接口)', remark: '端头架主阀组'),
SaleQuotationItemModel(name: '自动反冲洗过滤装置', remark: '流量:900L/min,过滤精度25μm'),
SaleQuotationItemModel(name: '全自动反冲洗过滤器电缆', remark: '控制器-自动反冲洗'),
SaleQuotationItemModel(name: '矿用本安型位移传感器'),
SaleQuotationItemModel(name: '矿用本安型压力传感器'),
SaleQuotationItemModel(name: '矿用本安型红外发射器'),
SaleQuotationItemModel(name: '矿用本安型LED信号灯'),
SaleQuotationItemModel(name: '倾角传感器'),
SaleQuotationItemModel(name: '各类安装附件'),
]);
RxList<SaleQuotationModel> groups = RxList<SaleQuotationModel>([]);
@override
void onReady() {
groups.assignAll([
SaleQuotationModel(name: '中间过渡架电控部分', items: products),
SaleQuotationModel(name: '端头架电控部分', items: products),
SaleQuotationModel(name: '主阀部分', items: products),
SaleQuotationModel(name: '自动反冲洗过滤器部分', items: products),
SaleQuotationModel(name: '位移测量部分', items: products),
SaleQuotationModel(name: '压力检测部分', items: products),
SaleQuotationModel(name: '煤机定位部分', items: products),
SaleQuotationModel(name: '姿态检测部分', items: products),
]);
super.onReady();
} }
} }

View File

@ -44,7 +44,7 @@ class ModalUtil {
Text( Text(
title, title,
style: TextStyle( style: TextStyle(
fontSize: ScreenAdaper.sp(40), fontSize: ScreenAdaper.height(30),
fontWeight: FontWeight.w500), fontWeight: FontWeight.w500),
) )
]), ]),
@ -66,7 +66,8 @@ class ModalUtil {
child: Text( child: Text(
'取消', '取消',
style: TextStyle( style: TextStyle(
color: Colors.black, fontSize: ScreenAdaper.sp(40)), color: Colors.black,
fontSize: ScreenAdaper.height(30)),
)), )),
)), )),
const VerticalDivider(), const VerticalDivider(),
@ -84,7 +85,8 @@ class ModalUtil {
child: Text( child: Text(
'确定', '确定',
style: TextStyle( style: TextStyle(
color: Colors.black, fontSize: ScreenAdaper.sp(40)), color: Colors.black,
fontSize: ScreenAdaper.height(30)),
), ),
), ),
)), )),

View File

@ -3,31 +3,60 @@ import 'package:flutter/services.dart';
import 'package:sk_base_mobile/app_theme.dart'; import 'package:sk_base_mobile/app_theme.dart';
import 'package:sk_base_mobile/util/screen_adaper_util.dart'; import 'package:sk_base_mobile/util/screen_adaper_util.dart';
class SkNumberInput extends StatelessWidget { class SkNumberInput extends StatefulWidget {
final TextEditingController textController; final TextEditingController textController;
final VoidCallback? onTap; final Function(FocusNode)? onTap;
final Function(String)? onChanged; final Function(String)? onChanged;
final bool isDense;
final EdgeInsetsGeometry? contentPadding;
final bool autoFocus;
final bool isRequired; final bool isRequired;
final String labelText; final String labelText;
final String? hint; final String? hint;
const SkNumberInput(
{super.key, SkNumberInput({
super.key,
required this.textController, required this.textController,
this.onTap, this.onTap,
this.onChanged, this.onChanged,
this.hint, this.hint,
this.isRequired = false, this.isRequired = false,
this.labelText = ''}); this.labelText = '',
this.autoFocus = false,
this.contentPadding,
this.isDense = false,
});
@override
State<SkNumberInput> createState() => _SkNumberInputState();
}
class _SkNumberInputState extends State<SkNumberInput> {
late FocusNode focusNode = FocusNode();
@override
void initState() {
super.initState();
if (widget.autoFocus) {
WidgetsBinding.instance.addPostFrameCallback((_) {
focusNode.requestFocus();
});
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return TextFormField( return TextFormField(
controller: textController, focusNode: focusNode,
onTap: () {
if (widget.onTap == null) {
widget.onTap!(focusNode);
}
},
controller: widget.textController,
onTapOutside: (event) { onTapOutside: (event) {
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
}, },
onChanged: onChanged ?? (_) {}, onChanged: widget.onChanged ?? (_) {},
onTap: onTap ?? () {},
textAlign: TextAlign.center, textAlign: TextAlign.center,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[ inputFormatters: <TextInputFormatter>[
@ -35,20 +64,22 @@ class SkNumberInput extends StatelessWidget {
FilteringTextInputFormatter.allow(RegExp(r'^\d+\.?\d{0,10}')), FilteringTextInputFormatter.allow(RegExp(r'^\d+\.?\d{0,10}')),
], ],
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: widget.contentPadding,
isDense: widget.isDense,
// contentPadding: EdgeInsets.symmetric(vertical: ScreenAdaper.height(18)), // contentPadding: EdgeInsets.symmetric(vertical: ScreenAdaper.height(18)),
floatingLabelBehavior: FloatingLabelBehavior.always, floatingLabelBehavior: FloatingLabelBehavior.always,
label: Row( label: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
if (isRequired) if (widget.isRequired)
Text( Text(
"*", "*",
style: TextStyle( style: TextStyle(
color: Colors.red, fontSize: ScreenAdaper.height(30)), color: Colors.red, fontSize: ScreenAdaper.height(30)),
), ),
Text( Text(
labelText, widget.labelText,
style: TextStyle(fontSize: ScreenAdaper.height(30)), style: TextStyle(fontSize: ScreenAdaper.height(30)),
), ),
]), ]),
@ -56,7 +87,7 @@ class SkNumberInput extends StatelessWidget {
borderSide: borderSide:
const BorderSide(color: AppTheme.primaryColorLight, width: 2), const BorderSide(color: AppTheme.primaryColorLight, width: 2),
borderRadius: BorderRadius.circular(ScreenAdaper.sp(15))), borderRadius: BorderRadius.circular(ScreenAdaper.sp(15))),
hintText: hint ?? '请输入', hintText: widget.hint ?? '请输入',
), ),
); );
} }

View File

@ -2,14 +2,17 @@ import 'package:flutter/material.dart';
import 'package:sk_base_mobile/app_theme.dart'; import 'package:sk_base_mobile/app_theme.dart';
import 'package:sk_base_mobile/util/screen_adaper_util.dart'; import 'package:sk_base_mobile/util/screen_adaper_util.dart';
class SkTextInput extends StatelessWidget { class SkTextInput extends StatefulWidget {
final TextEditingController textController; final TextEditingController textController;
final VoidCallback? onTap; final Function(FocusNode)? onTap;
final bool isRequired; final bool isRequired;
final String labelText; final String labelText;
final String? hint; final String? hint;
final bool isTextArea; final bool isTextArea;
const SkTextInput({ final bool isDense;
final EdgeInsetsGeometry? contentPadding;
final bool autoFocus;
SkTextInput({
super.key, super.key,
required this.textController, required this.textController,
this.onTap, this.onTap,
@ -17,30 +20,57 @@ class SkTextInput extends StatelessWidget {
this.isRequired = false, this.isRequired = false,
this.labelText = '', this.labelText = '',
this.isTextArea = false, this.isTextArea = false,
this.autoFocus = false,
this.contentPadding,
this.isDense = false,
}); });
@override
State<SkTextInput> createState() => _SkTextInputState();
}
class _SkTextInputState extends State<SkTextInput> {
late FocusNode focusNode = FocusNode();
@override
void initState() {
super.initState();
if (widget.autoFocus) {
WidgetsBinding.instance.addPostFrameCallback((_) {
focusNode.requestFocus();
});
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return TextFormField( return TextFormField(
controller: textController, focusNode: focusNode,
controller: widget.textController,
onTapOutside: (event) { onTapOutside: (event) {
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
}, },
maxLines: isTextArea ? 2 : 1, // maxLines: widget.isTextArea ? 2 : 1, //
onTap: onTap ?? () {}, onTap: () {
if (widget.onTap == null) {
widget.onTap!(focusNode);
}
},
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: widget.contentPadding,
isDense: widget.isDense,
floatingLabelBehavior: FloatingLabelBehavior.always, floatingLabelBehavior: FloatingLabelBehavior.always,
label: Row( label: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
if (isRequired) if (widget.isRequired)
Text( Text(
"*", "*",
style: TextStyle( style: TextStyle(
color: Colors.red, fontSize: ScreenAdaper.height(30)), color: Colors.red, fontSize: ScreenAdaper.height(30)),
), ),
Text( Text(
labelText, widget.labelText,
style: TextStyle(fontSize: ScreenAdaper.height(30)), style: TextStyle(fontSize: ScreenAdaper.height(30)),
), ),
]), ]),
@ -48,7 +78,7 @@ class SkTextInput extends StatelessWidget {
borderSide: borderSide:
const BorderSide(color: AppTheme.primaryColorLight, width: 2), const BorderSide(color: AppTheme.primaryColorLight, width: 2),
borderRadius: BorderRadius.circular(ScreenAdaper.sp(15))), borderRadius: BorderRadius.circular(ScreenAdaper.sp(15))),
hintText: hint ?? '请输入', hintText: widget.hint ?? '请输入',
), ),
); );
} }

View File

@ -11,7 +11,7 @@ class SkAppbar extends StatelessWidget implements PreferredSizeWidget {
return AppBar( return AppBar(
title: Text( title: Text(
title, title,
style: TextStyle(fontSize: ScreenAdaper.sp(40)), style: TextStyle(fontSize: ScreenAdaper.height(30)),
), ),
actions: action, actions: action,
); );