Skip to content

Commit

Permalink
- Add optional leading icon without size limits
Browse files Browse the repository at this point in the history
* - added dynamic leading icon feature

* - added dynamic leading icon in last notification card

* - added leading icon as optional

* - iOS config changes

* - added dynamic leading icon feature

* - remove duplicate code

* revert back sample

* reposition param

---------

Co-authored-by: Jay Shah <shreejiapps@gmail.com>
Co-authored-by: pratik <prats.khive@gmail.com>
  • Loading branch information
3 people committed Nov 25, 2023
1 parent a145f44 commit 01aecf4
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.0-dev.5
- fix https://github.com/oaktreeapps/stacked_notification_cards/issues/12
- fix https://github.com/oaktreeapps/stacked_notification_cards/issues/11

## 0.1.0-dev.4
- upgrade to latest flutter version
- fix https://github.com/oaktreeapps/stacked_notification_cards/issues/4
Expand Down
Empty file added coverage/lcov.info
Empty file.
4 changes: 2 additions & 2 deletions lib/src/model/notification_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import 'package:flutter/material.dart';

class NotificationCard {
final DateTime date;
final Widget leading;
final String title;
final String subtitle;
final Widget? leading;

const NotificationCard({
required this.date,
required this.leading,
required this.title,
required this.subtitle,
this.leading,
});
}
7 changes: 3 additions & 4 deletions lib/src/notification_tile/notification_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class NotificationTile extends StatelessWidget {
final TextStyle titleTextStyle;
final TextStyle? subtitleTextStyle;
final List<BoxShadow>? boxShadow;
final Widget? leading;

const NotificationTile({
Key? key,
Expand All @@ -30,6 +31,7 @@ class NotificationTile extends StatelessWidget {
required this.titleTextStyle,
required this.subtitleTextStyle,
required this.boxShadow,
required this.leading,
this.spacing = 0,
this.padding,
}) : super(key: key);
Expand Down Expand Up @@ -69,10 +71,7 @@ class NotificationTile extends StatelessWidget {
height: 17,
),
ListTile(
leading: Icon(
Icons.account_circle,
size: 48,
),
leading: leading,
title: Text(
title,
maxLines: 1,
Expand Down
1 change: 1 addition & 0 deletions lib/src/stacked_cards/animated_offset_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class AnimatedOffsetList extends StatelessWidget {
date: notification.date,
title: notification.title,
subtitle: notification.subtitle,
leading: notification.leading,
height: height,
color: tileColor,
cornerRadius: cornerRadius,
Expand Down
19 changes: 14 additions & 5 deletions lib/src/stacked_cards/expanded_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ class ExpandedList extends StatelessWidget {
/// then it will shrink (while animating). This will
/// give bounce animation when cards are expanding.
double _topPadding(int index) {
return Tween<double>(begin: _getSpacing(index, initialSpacing), end: _getSpacing(index, spacing))
return Tween<double>(
begin: _getSpacing(index, initialSpacing),
end: _getSpacing(index, spacing))
.animate(
CurvedAnimation(
parent: controller,
Expand Down Expand Up @@ -130,6 +132,7 @@ class ExpandedList extends StatelessWidget {
cardTitle: notificationCardTitle,
date: notification.date,
title: notification.title,
leading: notification.leading,
subtitle: notification.subtitle,
spacing: spacing,
height: containerHeight,
Expand Down Expand Up @@ -171,6 +174,7 @@ class BuildWithAnimation extends StatefulWidget {
final double spacing;
final double tilePadding;
final Widget view;

// final Key slidKey;

const BuildWithAnimation({
Expand All @@ -194,7 +198,8 @@ class BuildWithAnimation extends StatefulWidget {
_BuildWithAnimationState createState() => _BuildWithAnimationState();
}

class _BuildWithAnimationState extends State<BuildWithAnimation> with SingleTickerProviderStateMixin {
class _BuildWithAnimationState extends State<BuildWithAnimation>
with SingleTickerProviderStateMixin {
late AnimationController _animationController;

@override
Expand All @@ -212,14 +217,18 @@ class _BuildWithAnimationState extends State<BuildWithAnimation> with SingleTick
key: ValueKey('BuildWithAnimation'),
animation: _animationController,
builder: (_, __) => Opacity(
opacity: Tween<double>(begin: 1.0, end: 0.0).animate(_animationController).value,
opacity: Tween<double>(begin: 1.0, end: 0.0)
.animate(_animationController)
.value,
child: SizeTransition(
sizeFactor: Tween<double>(begin: 1.0, end: 0.0).animate(_animationController),
sizeFactor:
Tween<double>(begin: 1.0, end: 0.0).animate(_animationController),
child: Slidable(
key: UniqueKey(),
endActionPane: ActionPane(
motion: BehindMotion(),
dismissible: DismissiblePane(onDismissed: () => widget.onTapClear(widget.index)),
dismissible: DismissiblePane(
onDismissed: () => widget.onTapClear(widget.index)),
children: [
SlideButton(
padding: EdgeInsets.fromLTRB(
Expand Down
10 changes: 2 additions & 8 deletions lib/src/stacked_cards/last_notification_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,7 @@ class LastNotificationCard extends StatelessWidget {
child: Visibility(
visible: controller.value <= 0.2,
child: ListTile(
leading: Icon(
Icons.account_circle,
size: 48,
),
leading: notification.leading,
title: Text(
notification.title,
maxLines: 1,
Expand Down Expand Up @@ -136,10 +133,7 @@ class LastNotificationCard extends StatelessWidget {
child: Visibility(
visible: controller.value >= 0.2,
child: ListTile(
leading: Icon(
Icons.account_circle,
size: 48,
),
leading: notification.leading,
title: Text(
notification.title,
maxLines: 1,
Expand Down

0 comments on commit 01aecf4

Please sign in to comment.