Merge pull request #5829 from 21pages/scrollbar
desktop touch pad scroll
This commit is contained in:
commit
34d64fbcaf
@ -273,11 +273,29 @@ class MyTheme {
|
|||||||
: EdgeInsets.only(left: dialogPadding / 3);
|
: EdgeInsets.only(left: dialogPadding / 3);
|
||||||
|
|
||||||
static ScrollbarThemeData scrollbarTheme = ScrollbarThemeData(
|
static ScrollbarThemeData scrollbarTheme = ScrollbarThemeData(
|
||||||
thickness: MaterialStateProperty.all(kScrollbarThickness),
|
thickness: MaterialStateProperty.all(6),
|
||||||
|
thumbColor: MaterialStateProperty.resolveWith<Color?>((states) {
|
||||||
|
if (states.contains(MaterialState.dragged)) {
|
||||||
|
return Colors.grey[900];
|
||||||
|
} else if (states.contains(MaterialState.hovered)) {
|
||||||
|
return Colors.grey[700];
|
||||||
|
} else {
|
||||||
|
return Colors.grey[500];
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
crossAxisMargin: 4,
|
||||||
);
|
);
|
||||||
|
|
||||||
static ScrollbarThemeData scrollbarThemeDark = scrollbarTheme.copyWith(
|
static ScrollbarThemeData scrollbarThemeDark = scrollbarTheme.copyWith(
|
||||||
thumbColor: MaterialStateProperty.all(Colors.grey[500]),
|
thumbColor: MaterialStateProperty.resolveWith<Color?>((states) {
|
||||||
|
if (states.contains(MaterialState.dragged)) {
|
||||||
|
return Colors.grey[100];
|
||||||
|
} else if (states.contains(MaterialState.hovered)) {
|
||||||
|
return Colors.grey[300];
|
||||||
|
} else {
|
||||||
|
return Colors.grey[500];
|
||||||
|
}
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
static ThemeData lightTheme = ThemeData(
|
static ThemeData lightTheme = ThemeData(
|
||||||
|
@ -4,6 +4,7 @@ import 'dart:collection';
|
|||||||
import 'package:dynamic_layouts/dynamic_layouts.dart';
|
import 'package:dynamic_layouts/dynamic_layouts.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_hbb/desktop/widgets/scroll_wrapper.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:visibility_detector/visibility_detector.dart';
|
import 'package:visibility_detector/visibility_detector.dart';
|
||||||
@ -95,6 +96,8 @@ class _PeersViewState extends State<_PeersView> with WindowListener {
|
|||||||
return width;
|
return width;
|
||||||
}();
|
}();
|
||||||
|
|
||||||
|
final _scrollController = ScrollController();
|
||||||
|
|
||||||
_PeersViewState() {
|
_PeersViewState() {
|
||||||
_startCheckOnlines();
|
_startCheckOnlines();
|
||||||
}
|
}
|
||||||
@ -197,7 +200,9 @@ class _PeersViewState extends State<_PeersView> with WindowListener {
|
|||||||
: SizedBox(width: mobileWidth, child: visibilityChild);
|
: SizedBox(width: mobileWidth, child: visibilityChild);
|
||||||
}
|
}
|
||||||
|
|
||||||
final child = DynamicGridView.builder(
|
final Widget child;
|
||||||
|
if (isMobile) {
|
||||||
|
child = DynamicGridView.builder(
|
||||||
gridDelegate: SliverGridDelegateWithWrapping(
|
gridDelegate: SliverGridDelegateWithWrapping(
|
||||||
mainAxisSpacing: space / 2, crossAxisSpacing: space),
|
mainAxisSpacing: space / 2, crossAxisSpacing: space),
|
||||||
itemCount: peers.length,
|
itemCount: peers.length,
|
||||||
@ -205,6 +210,21 @@ class _PeersViewState extends State<_PeersView> with WindowListener {
|
|||||||
return buildOnePeer(peers[index]);
|
return buildOnePeer(peers[index]);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
child = DesktopScrollWrapper(
|
||||||
|
scrollController: _scrollController,
|
||||||
|
child: DynamicGridView.builder(
|
||||||
|
controller: _scrollController,
|
||||||
|
physics: DraggableNeverScrollableScrollPhysics(),
|
||||||
|
gridDelegate: SliverGridDelegateWithWrapping(
|
||||||
|
mainAxisSpacing: space / 2, crossAxisSpacing: space),
|
||||||
|
itemCount: peers.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
return buildOnePeer(peers[index]);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (updateEvent == UpdateEvent.load) {
|
if (updateEvent == UpdateEvent.load) {
|
||||||
_curPeers.clear();
|
_curPeers.clear();
|
||||||
_curPeers.addAll(peers.map((e) => e.id));
|
_curPeers.addAll(peers.map((e) => e.id));
|
||||||
|
@ -88,6 +88,11 @@ class _DesktopSettingPageState extends State<DesktopSettingPage>
|
|||||||
Get.put<RxInt>(selectedIndex, tag: _kSettingPageIndexTag);
|
Get.put<RxInt>(selectedIndex, tag: _kSettingPageIndexTag);
|
||||||
controller = PageController(initialPage: widget.initialPage);
|
controller = PageController(initialPage: widget.initialPage);
|
||||||
Get.put<PageController>(controller, tag: _kSettingPageControllerTag);
|
Get.put<PageController>(controller, tag: _kSettingPageControllerTag);
|
||||||
|
controller.addListener(() {
|
||||||
|
if (controller.page != null) {
|
||||||
|
selectedIndex.value = controller.page!.toInt();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -154,7 +159,7 @@ class _DesktopSettingPageState extends State<DesktopSettingPage>
|
|||||||
scrollController: controller,
|
scrollController: controller,
|
||||||
child: PageView(
|
child: PageView(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
physics: DraggableNeverScrollableScrollPhysics(),
|
physics: NeverScrollableScrollPhysics(),
|
||||||
children: _children(),
|
children: _children(),
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
@ -330,8 +335,10 @@ class _GeneralState extends State<_General> {
|
|||||||
child: _OptionCheckBox(context, "Always use software rendering",
|
child: _OptionCheckBox(context, "Always use software rendering",
|
||||||
'allow-always-software-render'),
|
'allow-always-software-render'),
|
||||||
));
|
));
|
||||||
children.add(
|
children.add(_OptionCheckBox(
|
||||||
_OptionCheckBox(context, 'Check for software update on startup','enable-check-update',
|
context,
|
||||||
|
'Check for software update on startup',
|
||||||
|
'enable-check-update',
|
||||||
isServer: false,
|
isServer: false,
|
||||||
));
|
));
|
||||||
if (bind.mainShowOption(key: 'allow-linux-headless')) {
|
if (bind.mainShowOption(key: 'allow-linux-headless')) {
|
||||||
|
@ -399,12 +399,12 @@ packages:
|
|||||||
dynamic_layouts:
|
dynamic_layouts:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "packages/dynamic_layouts"
|
path: "."
|
||||||
ref: "74cc4b495dcf3a4cb8df38d9ecc89f53f074a2c6"
|
ref: "24cb88413fa5181d949ddacbb30a65d5c459e7d9"
|
||||||
resolved-ref: "74cc4b495dcf3a4cb8df38d9ecc89f53f074a2c6"
|
resolved-ref: "24cb88413fa5181d949ddacbb30a65d5c459e7d9"
|
||||||
url: "https://github.com/21pages/packages.git"
|
url: "https://github.com/21pages/dynamic_layouts.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1+2"
|
version: "0.0.1+1"
|
||||||
event_bus:
|
event_bus:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -102,9 +102,8 @@ dependencies:
|
|||||||
flex_color_picker: ^3.3.0
|
flex_color_picker: ^3.3.0
|
||||||
dynamic_layouts:
|
dynamic_layouts:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/21pages/packages.git
|
url: https://github.com/21pages/dynamic_layouts.git
|
||||||
path: packages/dynamic_layouts
|
ref: 24cb88413fa5181d949ddacbb30a65d5c459e7d9
|
||||||
ref: 74cc4b495dcf3a4cb8df38d9ecc89f53f074a2c6
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
icons_launcher: ^2.0.4
|
icons_launcher: ^2.0.4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user