Skip to content

Commit

Permalink
feat(linux): platform tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
KRTirtho committed Nov 6, 2022
1 parent 50fe574 commit 7956dfa
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
9 changes: 8 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,16 @@ class _MyHomePageState extends State<MyHomePage> {
},
activeThumbColor: Colors.red,
activeTrackColor: Colors.red[800],
inactiveTrackColor: Colors.white,
inactiveThumbColor: Colors.green,
),
PlatformSwitch(
value: checked,
onChanged: (value) {
setState(() {
checked = value;
});
},
),
const PlatformTextField(
padding: EdgeInsets.all(8),
placeholder: "Placeholder",
Expand Down
37 changes: 36 additions & 1 deletion lib/src/platform_tooltip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:fluent_ui/fluent_ui.dart' as FluentUI;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:platform_ui/platform_ui.dart';
import 'package:platform_ui/src/tools/utils.dart';

class PlatformTooltip extends StatelessWidget with PlatformMixin<Widget> {
final String? message;
Expand Down Expand Up @@ -104,7 +105,41 @@ class PlatformTooltip extends StatelessWidget with PlatformMixin<Widget> {

@override
Widget linux(BuildContext context) {
return android(context);
return Tooltip(
key: key,
message: message,
richMessage: richMessage,
height: height,
padding: padding,
margin: margin,
verticalOffset: 10,
preferBelow: false,
excludeFromSemantics: excludeFromSemantics,
decoration:
(decoration as BoxDecoration? ?? const BoxDecoration()).copyWith(
color: Utils.brightnessSpecific(
context,
light: Colors.grey[900]?.withAlpha(200),
dark: Colors.black,
),
boxShadow: [
BoxShadow(
color: Theme.of(context).shadowColor.withOpacity(0.4),
blurRadius: 4,
),
],
borderRadius: BorderRadius.circular(5),
),
textStyle: (textStyle ?? PlatformTextTheme.of(context).label)
?.copyWith(color: Colors.white),
textAlign: textAlign,
waitDuration: waitDuration,
showDuration: showDuration,
triggerMode: triggerMode,
enableFeedback: enableFeedback,
onTriggered: onTriggered,
child: child,
);
}

@override
Expand Down

0 comments on commit 7956dfa

Please sign in to comment.