@@ -5,19 +5,14 @@ import 'package:clerk_flutter/clerk_flutter.dart';
5
5
import 'package:common/common.dart' ;
6
6
import 'package:flutter/material.dart' ;
7
7
8
- class ClerkUserButton extends StatefulWidget {
9
- final bool showName;
10
-
11
- const ClerkUserButton ({super .key, this .showName = true });
8
+ class ClerkUserButton extends StatelessWidget {
9
+ static const _closeDelay = Duration (milliseconds: 250 );
12
10
13
- @override
14
- State <ClerkUserButton > createState () => _ClerkUserButtonState ();
15
- }
11
+ final bool showName;
16
12
17
- class _ClerkUserButtonState extends State <ClerkUserButton > {
18
- static const _closeDelay = Duration (milliseconds: 250 );
13
+ ClerkUserButton ({super .key, this .showName = true });
19
14
20
- List < Clerk . Session > _sessions = [];
15
+ final _sessions = < Clerk . Session > [];
21
16
22
17
@override
23
18
Widget build (BuildContext context) {
@@ -32,7 +27,7 @@ class _ClerkUserButtonState extends State<ClerkUserButton> {
32
27
final sessions = auth.client.sessions;
33
28
34
29
// adding to a list of existing sessions means we have ones that are now deleted
35
- // available for prettier UI
30
+ // still available in `_sessions`, making for prettier UI
36
31
_sessions.addOrReplaceAll (sessions, by: (s) => s.id);
37
32
38
33
// after a delay period, all deleted sessions will have been closed, so we can
@@ -55,7 +50,7 @@ class _ClerkUserButtonState extends State<ClerkUserButton> {
55
50
session: session,
56
51
closed: auth.client.sessions.contains (session) == false ,
57
52
selected: session == auth.client.activeSession,
58
- showName: widget. showName,
53
+ showName: showName,
59
54
onTap: () => auth.call (context, () => auth.setActiveSession (session)),
60
55
),
61
56
if (auth.env.config.singleSessionMode == false )
@@ -71,6 +66,7 @@ class _ClerkUserButtonState extends State<ClerkUserButton> {
71
66
icon: Icons .add,
72
67
backgroundColor: ClerkColors .dawnPink,
73
68
borderColor: ClerkColors .nobel,
69
+ dashed: true ,
74
70
),
75
71
horizontalMargin24,
76
72
Text (
@@ -163,13 +159,15 @@ class _CircleIcon extends StatelessWidget {
163
159
final Color color;
164
160
final Color backgroundColor;
165
161
final Color ? borderColor;
162
+ final bool dashed;
166
163
167
164
const _CircleIcon ({
168
165
super .key,
169
166
required this .icon,
170
167
this .color = ClerkColors .stormGrey,
171
168
this .backgroundColor = Colors .transparent,
172
169
this .borderColor,
170
+ this .dashed = false ,
173
171
});
174
172
175
173
@override
@@ -181,7 +179,7 @@ class _CircleIcon extends StatelessWidget {
181
179
color: borderColor ?? color,
182
180
backgroundColor: backgroundColor,
183
181
dashLength: 2 ,
184
- gapLength: 2 ,
182
+ gapLength: dashed ? 2 : 0 ,
185
183
),
186
184
child: Icon (icon, size: 16 , color: color),
187
185
),
@@ -290,8 +288,9 @@ class _SessionRow extends StatelessWidget {
290
288
if (showName)
291
289
Text (
292
290
user.name,
293
- style:
294
- ClerkTextStyle .buttonTitle.copyWith (color: ClerkColors .almostBlack),
291
+ style: ClerkTextStyle .buttonTitle.copyWith (
292
+ color: ClerkColors .almostBlack,
293
+ ),
295
294
),
296
295
if (user.email is String )
297
296
Text (user.email! , style: ClerkTextStyle .buttonTitle),
0 commit comments