Skip to content

Commit

Permalink
chore: semi transparent system nav bars when tapping video in fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
MSOB7YY committed Jan 20, 2024
1 parent fab509d commit 2980827
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
17 changes: 12 additions & 5 deletions lib/controller/navigator_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,19 @@ class NamidaNavigator {
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge, overlays: SystemUiOverlay.values);
}

void setDefaultsetSystemUIOverlayStyle() {
void setDefaultSystemUIOverlayStyle({bool semiTransparent = false}) {
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
systemNavigationBarColor: Colors.transparent,
),
semiTransparent
? const SystemUiOverlayStyle(
statusBarColor: Colors.black45,
statusBarIconBrightness: Brightness.light,
systemNavigationBarColor: Colors.black45,
systemNavigationBarIconBrightness: Brightness.light,
)
: const SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
systemNavigationBarColor: Colors.transparent,
),
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void main() async {
NamidaNavigator.inst.setDefaultSystemUI(),
]);

NamidaNavigator.inst.setDefaultsetSystemUIOverlayStyle();
NamidaNavigator.inst.setDefaultSystemUIOverlayStyle();

ScrollSearchController.inst.initialize();
FlutterLocalNotificationsPlugin().cancelAll();
Expand Down
2 changes: 2 additions & 0 deletions lib/ui/widgets/video_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ class NamidaVideoControlsState extends State<NamidaVideoControls> with TickerPro
if (visible) {
// -- show status bar
NamidaNavigator.inst.setDefaultSystemUI();
NamidaNavigator.inst.setDefaultSystemUIOverlayStyle(semiTransparent: true);
} else {
// -- hide status bar
if (widget.isFullScreen && mounted) SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
NamidaNavigator.inst.setDefaultSystemUIOverlayStyle(semiTransparent: false);
}
}
}
Expand Down

0 comments on commit 2980827

Please sign in to comment.