adding packages
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../widgets/text.dart';
|
||||
|
||||
class CupertinoAvatarListTile extends StatelessWidget {
|
||||
const CupertinoAvatarListTile({
|
||||
required this.title,
|
||||
this.subtitle,
|
||||
this.actions,
|
||||
this.avatar,
|
||||
});
|
||||
|
||||
final Widget? avatar;
|
||||
final String? title, subtitle;
|
||||
final List<Widget>? actions;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final List<Widget> _widgets = <Widget>[
|
||||
Container(
|
||||
height: 60.0,
|
||||
width: 60.0,
|
||||
child: avatar,
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12.0),
|
||||
child: subtitle == null
|
||||
? CupertinoText(title, type: CupertinoTextTheme.title)
|
||||
: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
CupertinoText(title, type: CupertinoTextTheme.title),
|
||||
CupertinoText(subtitle, type: CupertinoTextTheme.subtitle),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
];
|
||||
|
||||
final Widget row = Container(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: Row(
|
||||
children: _widgets..addAll(actions ?? <Widget>[]),
|
||||
),
|
||||
);
|
||||
|
||||
return row;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../cell.dart';
|
||||
|
||||
class CupertinoBaseTile extends StatelessWidget {
|
||||
const CupertinoBaseTile({
|
||||
this.selected = false,
|
||||
this.editing = false,
|
||||
required this.child,
|
||||
this.accessory = CupertinoAccessory.none,
|
||||
this.editingAccessory = CupertinoEditingAccessory.none,
|
||||
this.editingAction = CupertinoEditingAction.remove,
|
||||
this.accessoryTap,
|
||||
this.onLongPressed,
|
||||
this.onTap,
|
||||
this.editingAccessoryTap,
|
||||
this.editingActionTap,
|
||||
this.padding,
|
||||
});
|
||||
|
||||
final bool editing, selected;
|
||||
final Widget child;
|
||||
final EdgeInsets? padding;
|
||||
final CupertinoEditingAction? editingAction;
|
||||
final CupertinoEditingAccessory? editingAccessory;
|
||||
final CupertinoAccessory? accessory;
|
||||
final VoidCallback? accessoryTap,
|
||||
onTap,
|
||||
onLongPressed,
|
||||
editingAccessoryTap,
|
||||
editingActionTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final List<Widget> _widgets = <Widget>[];
|
||||
|
||||
if (editing) {
|
||||
if (editingAccessory != null) {
|
||||
switch (editingAccessory) {
|
||||
case CupertinoEditingAccessory.disclosureIndicator:
|
||||
_widgets
|
||||
..add(
|
||||
const Icon(CupertinoIcons.right_chevron),
|
||||
);
|
||||
break;
|
||||
case CupertinoEditingAccessory.detailDisclosure:
|
||||
_widgets
|
||||
..addAll([
|
||||
IconButton(
|
||||
icon: const Icon(CupertinoIcons.info,
|
||||
color: CupertinoColors.activeBlue),
|
||||
onPressed: editingAccessoryTap,
|
||||
),
|
||||
const Icon(CupertinoIcons.right_chevron),
|
||||
]);
|
||||
break;
|
||||
case CupertinoEditingAccessory.detail:
|
||||
_widgets
|
||||
..add(
|
||||
IconButton(
|
||||
icon: const Icon(CupertinoIcons.info,
|
||||
color: CupertinoColors.activeBlue),
|
||||
onPressed: editingAccessoryTap,
|
||||
),
|
||||
);
|
||||
break;
|
||||
case CupertinoEditingAccessory.checkmark:
|
||||
_widgets
|
||||
..add(
|
||||
const Icon(CupertinoIcons.check_mark),
|
||||
);
|
||||
break;
|
||||
case CupertinoEditingAccessory.dragHandle:
|
||||
_widgets
|
||||
..add(IconButton(
|
||||
icon: const Icon(Icons.dehaze),
|
||||
onPressed: () {},
|
||||
));
|
||||
break;
|
||||
case null:
|
||||
case CupertinoEditingAccessory.none:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (accessory != null)
|
||||
switch (accessory) {
|
||||
case CupertinoAccessory.disclosureIndicator:
|
||||
_widgets..add(const Icon(CupertinoIcons.right_chevron));
|
||||
break;
|
||||
case CupertinoAccessory.detailDisclosure:
|
||||
_widgets
|
||||
..addAll([
|
||||
IconButton(
|
||||
icon: const Icon(CupertinoIcons.info),
|
||||
onPressed: accessoryTap,
|
||||
),
|
||||
const Icon(CupertinoIcons.right_chevron),
|
||||
]);
|
||||
break;
|
||||
case CupertinoAccessory.detail:
|
||||
_widgets
|
||||
..add(IconButton(
|
||||
icon: const Icon(CupertinoIcons.info),
|
||||
onPressed: accessoryTap,
|
||||
));
|
||||
break;
|
||||
case CupertinoAccessory.checkmark:
|
||||
_widgets..add(const Icon(CupertinoIcons.check_mark));
|
||||
break;
|
||||
case null:
|
||||
case CupertinoAccessory.none:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Widget? _editingAction;
|
||||
|
||||
if (editingAction != null) {
|
||||
switch (editingAction) {
|
||||
case CupertinoEditingAction.remove:
|
||||
_editingAction = Container(
|
||||
height: 25.0,
|
||||
width: 25.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red,
|
||||
borderRadius: BorderRadius.circular(25.0),
|
||||
),
|
||||
child: GestureDetector(
|
||||
child: Icon(
|
||||
Icons.remove,
|
||||
color: CupertinoColors.white,
|
||||
// size: 18.0,
|
||||
),
|
||||
onTap: editingActionTap,
|
||||
),
|
||||
);
|
||||
break;
|
||||
case CupertinoEditingAction.select:
|
||||
_editingAction = Container(
|
||||
height: 25.0,
|
||||
width: 25.0,
|
||||
decoration: selected
|
||||
? BoxDecoration(
|
||||
color: CupertinoColors.activeBlue,
|
||||
borderRadius: BorderRadius.circular(25.0),
|
||||
)
|
||||
: new BoxDecoration(
|
||||
border: new Border.all(
|
||||
color: CupertinoColors.lightBackgroundGray),
|
||||
shape: BoxShape.circle),
|
||||
child: GestureDetector(
|
||||
child: Icon(
|
||||
CupertinoIcons.check_mark,
|
||||
color: selected ? CupertinoColors.white : Colors.transparent,
|
||||
),
|
||||
onTap: editingActionTap,
|
||||
),
|
||||
);
|
||||
break;
|
||||
case null:
|
||||
case CupertinoEditingAction.none:
|
||||
_editingAction = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Color? _rowColor = Colors.transparent;
|
||||
|
||||
if (selected && editing) {
|
||||
_rowColor = Colors.lightBlue[50];
|
||||
}
|
||||
|
||||
if (!editing && selected) {
|
||||
_rowColor = Colors.lightBlue[50];
|
||||
}
|
||||
|
||||
final Widget row = GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: onTap,
|
||||
onLongPress: onLongPressed,
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
child: Container(
|
||||
color: _rowColor,
|
||||
padding: padding,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: editing && _editingAction != null
|
||||
? const EdgeInsets.only(left: 12.0)
|
||||
: null,
|
||||
child: editing ? _editingAction : null,
|
||||
),
|
||||
Expanded(child: child),
|
||||
]..addAll(_widgets),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
return row;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CupertinoTextMenu extends StatelessWidget {
|
||||
final bool lastItem;
|
||||
final List<Widget?> children;
|
||||
|
||||
CupertinoTextMenu({
|
||||
required this.children,
|
||||
this.lastItem = false,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
border: Border(
|
||||
top: BorderSide(color: Color(0xFFBCBBC1), width: 0.0),
|
||||
bottom: BorderSide(color: Color(0xFFBCBBC1), width: 0.0),
|
||||
),
|
||||
),
|
||||
height: 44.0,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: children as List<Widget>,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../widgets/text.dart';
|
||||
|
||||
class CupertinoPhoneListTile extends StatelessWidget {
|
||||
final String? subtitle, title;
|
||||
final List<Widget>? actions;
|
||||
final IconData? icon;
|
||||
final bool? hideLeadingIcon;
|
||||
|
||||
const CupertinoPhoneListTile({
|
||||
this.actions,
|
||||
this.subtitle,
|
||||
required this.title,
|
||||
this.icon,
|
||||
this.hideLeadingIcon = true,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget row;
|
||||
if (subtitle == null) {
|
||||
row = Container(
|
||||
// color: selected ? Colors.grey[400] : Colors.transparent,
|
||||
height: 40.0,
|
||||
padding: EdgeInsets.only(top: subtitle == null ? 0.0 : 9.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: hideLeadingIcon! ? 12.0 : 38.0,
|
||||
child: icon != null && !hideLeadingIcon!
|
||||
? Align(
|
||||
alignment: Alignment.center,
|
||||
child: Icon(
|
||||
icon,
|
||||
color: CupertinoColors.inactiveGray,
|
||||
size: 18.0,
|
||||
),
|
||||
)
|
||||
: null,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 1.0, bottom: 0.0, right: 10.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
CupertinoText(title, type: CupertinoTextTheme.title)
|
||||
],
|
||||
),
|
||||
),
|
||||
]..addAll(actions ?? <Widget>[])),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else {
|
||||
row = Container(
|
||||
// color: selected ? Colors.grey[400] : Colors.transparent,
|
||||
height: 60.0,
|
||||
padding: const EdgeInsets.only(top: 9.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: hideLeadingIcon! ? 12.0 : 38.0,
|
||||
child: icon != null && !hideLeadingIcon!
|
||||
? Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: Icon(
|
||||
icon,
|
||||
color: CupertinoColors.inactiveGray,
|
||||
size: 18.0,
|
||||
),
|
||||
)
|
||||
: null,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 1.0, bottom: 9.0, right: 10.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
CupertinoText(title, type: CupertinoTextTheme.title),
|
||||
CupertinoText(subtitle,
|
||||
type: CupertinoTextTheme.subtitle),
|
||||
],
|
||||
),
|
||||
),
|
||||
]..addAll(actions ?? <Widget>[])),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return row;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user