Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
4f7d7b56
Unverified
Commit
4f7d7b56
authored
Mar 07, 2022
by
Taha Tesser
Committed by
GitHub
Mar 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CupertinoTabBar: Add clickable cursor on web (#96996)
parent
66826e8f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
8 deletions
+52
-8
bottom_tab_bar.dart
packages/flutter/lib/src/cupertino/bottom_tab_bar.dart
+13
-8
bottom_tab_bar_test.dart
packages/flutter/test/cupertino/bottom_tab_bar_test.dart
+39
-0
No files found.
packages/flutter/lib/src/cupertino/bottom_tab_bar.dart
View file @
4f7d7b56
...
...
@@ -4,6 +4,8 @@
import
'dart:ui'
show
ImageFilter
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/widgets.dart'
;
import
'colors.dart'
;
...
...
@@ -235,6 +237,8 @@ class CupertinoTabBar extends StatelessWidget implements PreferredSizeWidget {
tabIndex:
index
+
1
,
tabCount:
items
.
length
,
),
child:
MouseRegion
(
cursor:
kIsWeb
?
SystemMouseCursors
.
click
:
MouseCursor
.
defer
,
child:
GestureDetector
(
behavior:
HitTestBehavior
.
opaque
,
onTap:
onTap
==
null
?
null
:
()
{
onTap
!(
index
);
},
...
...
@@ -248,6 +252,7 @@ class CupertinoTabBar extends StatelessWidget implements PreferredSizeWidget {
),
),
),
),
active:
active
,
),
);
...
...
packages/flutter/test/cupertino/bottom_tab_bar_test.dart
View file @
4f7d7b56
...
...
@@ -5,6 +5,8 @@
import
'dart:typed_data'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
@@ -568,4 +570,41 @@ Future<void> main() async {
decoratedBoxHiddenBorder
.
decoration
as
BoxDecoration
;
expect
(
boxDecorationHiddenBorder
.
border
,
isNull
);
});
testWidgets
(
'Hovering over tab bar item updates cursor to clickable on Web'
,
(
WidgetTester
tester
)
async
{
await
pumpWidgetWithBoilerplate
(
tester
,
MediaQuery
(
data:
const
MediaQueryData
(),
child:
Center
(
child:
CupertinoTabBar
(
items:
const
<
BottomNavigationBarItem
>[
BottomNavigationBarItem
(
icon:
Icon
(
CupertinoIcons
.
alarm
),
label:
'Tab 1'
,
),
BottomNavigationBarItem
(
icon:
Icon
(
CupertinoIcons
.
app_badge
),
label:
'Tab 2'
,
),
],
),
),
),
);
final
TestGesture
gesture
=
await
tester
.
createGesture
(
kind:
PointerDeviceKind
.
mouse
,
pointer:
1
);
await
gesture
.
addPointer
(
location:
const
Offset
(
10
,
10
));
await
tester
.
pumpAndSettle
();
expect
(
RendererBinding
.
instance
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
basic
);
final
Offset
tabItem
=
tester
.
getCenter
(
find
.
text
(
'Tab 1'
));
await
gesture
.
moveTo
(
tabItem
);
addTearDown
(
gesture
.
removePointer
);
await
tester
.
pumpAndSettle
();
expect
(
RendererBinding
.
instance
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
kIsWeb
?
SystemMouseCursors
.
click
:
SystemMouseCursors
.
basic
,
);
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment