Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ginkgo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fred
ginkgo
Commits
89506558
Commit
89506558
authored
1 year ago
by
vjrj
Browse files
Options
Downloads
Patches
Plain Diff
Animate slidable in contacts to show this feature
parent
901e9ec7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/ui/ui_helpers.dart
+76
-0
76 additions, 0 deletions
lib/ui/ui_helpers.dart
lib/ui/widgets/third_screen/contacts_page.dart
+2
-2
2 additions, 2 deletions
lib/ui/widgets/third_screen/contacts_page.dart
with
78 additions
and
2 deletions
lib/ui/ui_helpers.dart
+
76
−
0
View file @
89506558
...
...
@@ -5,9 +5,11 @@ import 'package:easy_localization/easy_localization.dart';
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_slidable/flutter_slidable.dart'
;
import
'package:path_provider/path_provider.dart'
;
import
'package:timeago/timeago.dart'
as
timeago
;
import
'../data/models/app_cubit.dart'
;
import
'../data/models/contact.dart'
;
import
'../data/models/node_list_cubit.dart'
;
import
'../data/models/transaction_cubit.dart'
;
...
...
@@ -190,6 +192,80 @@ void fetchTransactions(BuildContext context) {
transCubit
.
fetchTransactions
(
nodeListCubit
);
}
class
SlidableContactTile
extends
StatefulWidget
{
const
SlidableContactTile
(
this
.
contact
,
{
super
.
key
,
required
this
.
index
,
required
this
.
context
,
this
.
onTap
,
this
.
onLongPress
,
this
.
trailing
});
@override
State
<
SlidableContactTile
>
createState
()
=
>
_SlidableContactTile
();
final
Contact
contact
;
final
int
index
;
final
BuildContext
context
;
final
VoidCallback
?
onTap
;
final
VoidCallback
?
onLongPress
;
final
Widget
?
trailing
;
}
class
_SlidableContactTile
extends
State
<
SlidableContactTile
>
{
@override
void
initState
()
{
super
.
initState
();
_start
();
}
// Based in https://github.com/letsar/flutter_slidable/issues/288
Future
<
void
>
_start
()
async
{
if
(
widget
.
index
==
0
&&
!
context
.
read
<
AppCubit
>()
.
wasTutorialShown
(
tutorialId
))
{
await
Future
<
void
>
.
delayed
(
const
Duration
(
seconds:
1
));
if
(
!
mounted
)
{
return
;
}
ScaffoldMessenger
.
of
(
context
)
.
showSnackBar
(
SnackBar
(
content:
Text
(
tr
(
'slidable_tutorial'
)),
action:
SnackBarAction
(
label:
'OK'
,
onPressed:
()
{
ScaffoldMessenger
.
of
(
context
)
.
hideCurrentSnackBar
();
context
.
read
<
AppCubit
>()
.
onFinishTutorial
(
tutorialId
);
// context.read<AppCubit>().warningViewed();
},
),
),
);
final
SlidableController
?
slidable
=
Slidable
.
of
(
context
);
slidable
?.
openEndActionPane
(
duration:
const
Duration
(
milliseconds:
300
),
curve:
Curves
.
decelerate
,
);
Future
<
void
>
.
delayed
(
const
Duration
(
seconds:
1
),
()
{
slidable
?.
close
(
duration:
const
Duration
(
milliseconds:
300
),
curve:
Curves
.
bounceInOut
,
);
});
}
}
static
String
tutorialId
=
'slidable_tutorial'
;
@override
Widget
build
(
_
)
=
>
contactToListItem
(
widget
.
contact
,
widget
.
index
,
widget
.
context
,
onTap:
widget
.
onTap
,
onLongPress:
widget
.
onLongPress
,
trailing:
widget
.
trailing
);
}
ListTile
contactToListItem
(
Contact
contact
,
int
index
,
BuildContext
context
,
{
VoidCallback
?
onTap
,
VoidCallback
?
onLongPress
,
Widget
?
trailing
})
{
final
String
title
=
contact
.
title
;
...
...
This diff is collapsed.
Click to expand it.
lib/ui/widgets/third_screen/contacts_page.dart
+
2
−
2
View file @
89506558
...
...
@@ -130,8 +130,8 @@ class _ContactsPageState extends State<ContactsPage> {
),
],
),
child:
contactToListItem
(
contact
,
index
,
contex
t
,
onLongPress:
()
{
child:
SlidableContactTile
(
contac
t
,
index:
index
,
context:
context
,
onLongPress:
()
{
showDialog
(
context:
context
,
builder:
(
BuildContext
context
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment