mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-08-24 09:21:29 +08:00
49 lines
1.4 KiB
Dart
49 lines
1.4 KiB
Dart
/*
|
|
* SPDX-FileCopyrightText: 2019-2021 Vishesh Handa <me@vhanda.in>
|
|
*
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
class IconDismissable extends Dismissible {
|
|
final Color backgroundColor;
|
|
final IconData iconData;
|
|
|
|
IconDismissable({
|
|
required super.key,
|
|
required this.backgroundColor,
|
|
required this.iconData,
|
|
required Function(DismissDirection) super.onDismissed,
|
|
required super.child,
|
|
}) : super(
|
|
background: Container(
|
|
color: backgroundColor,
|
|
alignment: AlignmentDirectional.centerStart,
|
|
child: const Padding(
|
|
padding: EdgeInsets.fromLTRB(16.0, 0.0, 0.0, 0.0),
|
|
child: Icon(
|
|
Icons.delete,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
secondaryBackground: Container(
|
|
color: backgroundColor,
|
|
alignment: AlignmentDirectional.centerEnd,
|
|
child: const Padding(
|
|
padding: EdgeInsets.fromLTRB(0.0, 0.0, 16.0, 0.0),
|
|
child: Icon(
|
|
Icons.delete,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
dismissThresholds: {
|
|
DismissDirection.horizontal: 0.6,
|
|
DismissDirection.endToStart: 0.6,
|
|
DismissDirection.startToEnd: 0.6,
|
|
},
|
|
);
|
|
}
|