Skip to content

Commit

Permalink
scroll with mouse touch
Browse files Browse the repository at this point in the history
  • Loading branch information
niuhuan committed Jan 18, 2022
1 parent 2559017 commit 6a3857d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:event/event.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:nhentai/screens/components/mouse_and_touch_scroll_behavior.dart';
import 'package:nhentai/screens/init_screen.dart';

import 'basic/configs/themes.dart';
Expand Down Expand Up @@ -37,6 +38,7 @@ class MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
scrollBehavior: mouseAndTouchScrollBehavior,
debugShowCheckedModeBanner: false,
theme: currentThemeData(),
darkTheme: currentDarkTheme(),
Expand Down
1 change: 0 additions & 1 deletion lib/screens/comic_reader_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import 'package:nhentai/basic/configs/reader_direction.dart';
import 'package:nhentai/basic/configs/reader_type.dart';
import 'package:nhentai/basic/configs/web_address.dart';
import 'package:nhentai/basic/entities/entities.dart';
import 'package:nhentai/screens/components/content_loading.dart';
import 'package:nhentai/screens/components/images.dart';
import 'package:photo_view/photo_view_gallery.dart';

Expand Down
12 changes: 12 additions & 0 deletions lib/screens/components/mouse_and_touch_scroll_behavior.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'dart:ui';
import 'package:flutter/material.dart';

final mouseAndTouchScrollBehavior = MouseAndTouchScrollBehavior();

class MouseAndTouchScrollBehavior extends MaterialScrollBehavior {
@override
Set<PointerDeviceKind> get dragDevices => {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
};
}

0 comments on commit 6a3857d

Please sign in to comment.