添加ASVerticalTileItem

null_safety
小赖 4 years ago
parent e68c860227
commit d6bf8b7429

@ -15,6 +15,7 @@ class _ExampleListTileState extends State<ExampleListTile> {
return ASScaffold(
title: 'ASListTile',
body: ListView(
padding: EdgeInsets.symmetric(horizontal: 12.w),
children: [
SizedBox(
height: 8.w,
@ -34,7 +35,7 @@ class _ExampleListTileState extends State<ExampleListTile> {
title: '订单编号',
text:
'DDAWMFOAGNAIOWNGOANIWOGNAOWIDJAWIOHFA92474Y2798489TY892YH8G67TGT2UBF29GB8298H42897YH472H',
trail: Icon(Icons.ac_unit_outlined),
// trail: Icon(Icons.ac_unit_outlined),
),
],
),
@ -50,11 +51,19 @@ class _ExampleListTileState extends State<ExampleListTile> {
),
),
),
20.hb,
ASOptionTile.single(
item: ASEditTile(
title: Text('TEST'),
),
),
20.hb,
ASOptionTile.single(
item: ASVerticalTileItem(
title: 'AS Vertical Tile',
child: TextField(),
),
),
],
),
);

@ -18,6 +18,8 @@ export 'dialog/as_dialog.dart';
export 'list_tile/as_list_tile.dart';
export 'list_tile/as_option_tile.dart';
export 'list_tile/as_edit_tile.dart';
export 'list_tile/as_option_tile_item.dart';
export 'list_tile/as_vertical_tile_item.dart';
export 'tag/as_tag.dart';
export 'divider/as_divider.dart';

@ -11,7 +11,7 @@ class ASEditTile extends StatefulWidget {
this.title,
this.node,
this.hintText,
@required this.controller,
this.controller,
}) : super(key: key);
@override

@ -1,8 +1,6 @@
import 'package:ansu_ui/ansu_ui.dart';
import 'package:ansu_ui/styles/as_colors.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:ansu_ui/extension/sizedbox_extension.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
///Tile
@ -12,8 +10,11 @@ class ASOptionTile extends StatelessWidget {
///Widget
final Widget item;
///item 使`ASOptionTileItem`,`ASVerticalTileItem`,`ASListTile`
ASOptionTile({Key key, this.items, this.item}) : super(key: key);
///Tile
ASOptionTile.single({Key key, @required this.item})
: items = [],
super(key: key);
@ -40,48 +41,3 @@ class ASOptionTile extends StatelessWidget {
);
}
}
class ASOptionTileItem extends StatelessWidget {
final Widget leading;
final Widget title;
final onPressed;
const ASOptionTileItem({
Key key,
this.leading,
this.title,
this.onPressed,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onPressed,
borderRadius: BorderRadius.circular(5.w),
child: ConstrainedBox(
constraints: BoxConstraints(minHeight: 46.w),
child: Row(
children: [
14.wb,
leading ?? SizedBox(),
leading != null ? 8.wb : 0.wb,
Expanded(
child: DefaultTextStyle(
style: TextStyle(
color: Colors.black.withOpacity(0.65),
fontSize: 14.sp,
),
child: title,
),
),
14.wb,
Icon(
CupertinoIcons.chevron_forward,
size: 16.w,
),
14.wb,
],
),
),
);
}
}

@ -0,0 +1,49 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:ansu_ui/extension/sizedbox_extension.dart';
class ASOptionTileItem extends StatelessWidget {
final Widget leading;
final Widget title;
final onPressed;
const ASOptionTileItem({
Key key,
this.leading,
this.title,
this.onPressed,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onPressed,
borderRadius: BorderRadius.circular(5.w),
child: ConstrainedBox(
constraints: BoxConstraints(minHeight: 46.w),
child: Row(
children: [
14.wb,
leading ?? SizedBox(),
leading != null ? 8.wb : 0.wb,
Expanded(
child: DefaultTextStyle(
style: TextStyle(
color: Colors.black.withOpacity(0.65),
fontSize: 14.sp,
),
child: title,
),
),
14.wb,
Icon(
CupertinoIcons.chevron_forward,
size: 16.w,
),
14.wb,
],
),
),
);
}
}

@ -0,0 +1,49 @@
import 'package:ansu_ui/ansu_ui.dart';
import 'package:ansu_ui/styles/as_colors.dart';
import 'package:flutter/material.dart';
class ASVerticalTileItem extends StatelessWidget {
///
final String title;
///child
final Widget child;
final EdgeInsets padding;
ASVerticalTileItem({
Key key,
@required this.title,
this.child,
this.padding,
}) : super(key: key);
EdgeInsets get _widgetPadding =>
padding ??
EdgeInsets.symmetric(
horizontal: 10.w,
vertical: 12.w,
);
@override
Widget build(BuildContext context) {
return Padding(
padding: _widgetPadding,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
title,
style: TextStyle(
color: kTextSubColor,
fontSize: 14.sp,
),
),
13.hb,
ASDivider(),
child,
],
),
);
}
}
Loading…
Cancel
Save