first change
parent
480017f887
commit
26e80356e1
@ -1,79 +1,26 @@
|
|||||||
import 'package:doctor_app_flutter/config/config.dart';
|
import 'package:doctor_app_flutter/config/config.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_flexible_toast/flutter_flexible_toast.dart';
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
|
|
||||||
class DrAppToastMsg {
|
class DrAppToastMsg {
|
||||||
void showLongToast(msg) {
|
|
||||||
FlutterFlexibleToast.showToast(
|
|
||||||
message: msg,
|
|
||||||
toastLength: Toast.LENGTH_LONG,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void showSuccesToast(msg) {
|
static void showSuccesToast(msg) {
|
||||||
FlutterFlexibleToast.showToast(
|
Fluttertoast.showToast(
|
||||||
message: msg,
|
msg: msg,
|
||||||
toastLength: Toast.LENGTH_SHORT,
|
toastLength: Toast.LENGTH_SHORT,
|
||||||
backgroundColor: AppGlobal.appGreenColor,
|
gravity: ToastGravity.TOP,
|
||||||
icon: ICON.SUCCESS,
|
// timeInSecForIosWeb: timeInSeconds,
|
||||||
fontSize: 16,
|
backgroundColor: Colors.green,
|
||||||
imageSize: 35,
|
textColor: Colors.white,
|
||||||
textColor: Colors.white);
|
fontSize: 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void showErrorToast(msg) {
|
static void showErrorToast(msg) {
|
||||||
FlutterFlexibleToast.showToast(
|
Fluttertoast.showToast(
|
||||||
message: msg,
|
msg: msg,
|
||||||
toastLength: Toast.LENGTH_SHORT,
|
toastLength: Toast.LENGTH_SHORT,
|
||||||
toastGravity: ToastGravity.TOP,
|
gravity: ToastGravity.TOP,
|
||||||
backgroundColor: Colors.red,
|
backgroundColor: Colors.red,
|
||||||
icon: ICON.CLOSE,
|
|
||||||
fontSize: 16,
|
|
||||||
imageSize: 35,
|
|
||||||
timeInSeconds: 912,
|
|
||||||
textColor: Colors.white);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void showShortToast(msg) {
|
|
||||||
FlutterFlexibleToast.showToast(
|
|
||||||
message: msg,
|
|
||||||
toastLength: Toast.LENGTH_SHORT,
|
|
||||||
icon: ICON.INFO,
|
|
||||||
timeInSeconds: 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void showTopShortToast(msg) {
|
|
||||||
FlutterFlexibleToast.showToast(
|
|
||||||
message: msg,
|
|
||||||
toastLength: Toast.LENGTH_SHORT,
|
|
||||||
toastGravity: ToastGravity.TOP,
|
|
||||||
icon: ICON.WARNING,
|
|
||||||
timeInSeconds: 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void showCenterShortToast(msg) {
|
|
||||||
FlutterFlexibleToast.showToast(
|
|
||||||
message: msg,
|
|
||||||
toastLength: Toast.LENGTH_SHORT,
|
|
||||||
toastGravity: ToastGravity.CENTER,
|
|
||||||
icon: ICON.WARNING,
|
|
||||||
timeInSeconds: 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void showCenterShortLoadingToast(msg) {
|
|
||||||
FlutterFlexibleToast.showToast(
|
|
||||||
message: msg,
|
|
||||||
toastLength: Toast.LENGTH_LONG,
|
|
||||||
toastGravity: ToastGravity.BOTTOM,
|
|
||||||
icon: ICON.LOADING,
|
|
||||||
radius: 20,
|
|
||||||
elevation: 10,
|
|
||||||
textColor: Colors.white,
|
textColor: Colors.white,
|
||||||
|
fontSize: 16);
|
||||||
timeInSeconds: 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cancelToast(msg) {
|
|
||||||
FlutterFlexibleToast.cancel();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,127 +0,0 @@
|
|||||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
||||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
||||||
import 'package:expandable/expandable.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
|
|
||||||
/// App Expandable Notifier with animation
|
|
||||||
/// [headerWidget] widget want to show in the header
|
|
||||||
/// [bodyWidget] widget want to show in the body
|
|
||||||
/// [title] the widget title
|
|
||||||
/// [collapsed] The widget shown in the collapsed state
|
|
||||||
class AppExpandableNotifier extends StatefulWidget {
|
|
||||||
final Widget headerWidget;
|
|
||||||
final Widget bodyWidget;
|
|
||||||
final String title;
|
|
||||||
final Widget collapsed;
|
|
||||||
final bool isExpand;
|
|
||||||
bool expandFlag = false;
|
|
||||||
var controller = new ExpandableController();
|
|
||||||
AppExpandableNotifier(
|
|
||||||
{this.headerWidget,
|
|
||||||
this.bodyWidget,
|
|
||||||
this.title,
|
|
||||||
this.collapsed,
|
|
||||||
this.isExpand = false});
|
|
||||||
|
|
||||||
_AppExpandableNotifier createState() => _AppExpandableNotifier();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AppExpandableNotifier extends State<AppExpandableNotifier> {
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
setState(() {
|
|
||||||
if (widget.isExpand) {
|
|
||||||
widget.expandFlag = widget.isExpand;
|
|
||||||
widget.controller.expanded = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
|
|
||||||
return ExpandableNotifier(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 10, right: 10, top: 4),
|
|
||||||
child: Card(
|
|
||||||
color: Colors.grey[200],
|
|
||||||
clipBehavior: Clip.antiAlias,
|
|
||||||
child: Column(
|
|
||||||
children: <Widget>[
|
|
||||||
SizedBox(
|
|
||||||
child: widget.headerWidget,
|
|
||||||
),
|
|
||||||
ScrollOnExpand(
|
|
||||||
scrollOnExpand: true,
|
|
||||||
scrollOnCollapse: false,
|
|
||||||
child: ExpandablePanel(
|
|
||||||
hasIcon: false,
|
|
||||||
theme: const ExpandableThemeData(
|
|
||||||
headerAlignment: ExpandablePanelHeaderAlignment.center,
|
|
||||||
tapBodyToCollapse: true,
|
|
||||||
),
|
|
||||||
header: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.all(10),
|
|
||||||
child: Text(
|
|
||||||
widget.title ?? TranslationBase.of(context).details,
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontSize: SizeConfig.textMultiplier * 2,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
IconButton(
|
|
||||||
icon: new Container(
|
|
||||||
height: 28.0,
|
|
||||||
width: 30.0,
|
|
||||||
decoration: new BoxDecoration(
|
|
||||||
color: Theme.of(context).primaryColor,
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
),
|
|
||||||
child: new Center(
|
|
||||||
child: new Icon(
|
|
||||||
widget.expandFlag
|
|
||||||
? Icons.keyboard_arrow_up
|
|
||||||
: Icons.keyboard_arrow_down,
|
|
||||||
color: Colors.white,
|
|
||||||
size: 30.0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
setState(() {
|
|
||||||
widget.expandFlag = !widget.expandFlag;
|
|
||||||
widget.controller.expanded = widget.expandFlag;
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
]),
|
|
||||||
collapsed: widget.collapsed ?? Container(),
|
|
||||||
expanded: widget.bodyWidget,
|
|
||||||
builder: (_, collapsed, expanded) {
|
|
||||||
return Padding(
|
|
||||||
padding: EdgeInsets.only(left: 5, right: 5, bottom: 5),
|
|
||||||
child: Expandable(
|
|
||||||
controller: widget.controller,
|
|
||||||
collapsed: collapsed,
|
|
||||||
expanded: expanded,
|
|
||||||
theme: const ExpandableThemeData(crossFadePoint: 0),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue