adjust about setting tab position
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
5497a59823
commit
16c1813df1
@ -26,11 +26,10 @@ const double _kContentFontSize = 15;
|
|||||||
const Color _accentColor = MyTheme.accent;
|
const Color _accentColor = MyTheme.accent;
|
||||||
|
|
||||||
class _TabInfo {
|
class _TabInfo {
|
||||||
late final int index;
|
|
||||||
late final String label;
|
late final String label;
|
||||||
late final IconData unselected;
|
late final IconData unselected;
|
||||||
late final IconData selected;
|
late final IconData selected;
|
||||||
_TabInfo(this.index, this.label, this.unselected, this.selected);
|
_TabInfo(this.label, this.unselected, this.selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
class DesktopSettingPage extends StatefulWidget {
|
class DesktopSettingPage extends StatefulWidget {
|
||||||
@ -43,17 +42,15 @@ class DesktopSettingPage extends StatefulWidget {
|
|||||||
class _DesktopSettingPageState extends State<DesktopSettingPage>
|
class _DesktopSettingPageState extends State<DesktopSettingPage>
|
||||||
with TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
|
with TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
|
||||||
final List<_TabInfo> _setting_tabs = <_TabInfo>[
|
final List<_TabInfo> _setting_tabs = <_TabInfo>[
|
||||||
_TabInfo(
|
_TabInfo('User Interface', Icons.language_outlined, Icons.language_sharp),
|
||||||
0, 'User Interface', Icons.language_outlined, Icons.language_sharp),
|
_TabInfo('Security', Icons.enhanced_encryption_outlined,
|
||||||
_TabInfo(1, 'Security', Icons.enhanced_encryption_outlined,
|
|
||||||
Icons.enhanced_encryption_sharp),
|
Icons.enhanced_encryption_sharp),
|
||||||
_TabInfo(2, 'Display', Icons.desktop_windows_outlined,
|
_TabInfo(
|
||||||
Icons.desktop_windows_sharp),
|
'Display', Icons.desktop_windows_outlined, Icons.desktop_windows_sharp),
|
||||||
_TabInfo(3, 'Audio', Icons.volume_up_outlined, Icons.volume_up_sharp),
|
_TabInfo('Audio', Icons.volume_up_outlined, Icons.volume_up_sharp),
|
||||||
_TabInfo(4, 'Connection', Icons.link_outlined, Icons.link_sharp),
|
_TabInfo('Connection', Icons.link_outlined, Icons.link_sharp),
|
||||||
|
_TabInfo('About RustDesk', Icons.info_outline, Icons.info_sharp)
|
||||||
];
|
];
|
||||||
final _TabInfo _about_tab =
|
|
||||||
_TabInfo(5, 'About RustDesk', Icons.info_outline, Icons.info_sharp);
|
|
||||||
|
|
||||||
late PageController controller;
|
late PageController controller;
|
||||||
RxInt _selectedIndex = 0.obs;
|
RxInt _selectedIndex = 0.obs;
|
||||||
@ -80,10 +77,6 @@ class _DesktopSettingPageState extends State<DesktopSettingPage>
|
|||||||
children: [
|
children: [
|
||||||
_header(),
|
_header(),
|
||||||
Flexible(child: _listView(tabs: _setting_tabs)),
|
Flexible(child: _listView(tabs: _setting_tabs)),
|
||||||
_listItem(tab: _about_tab),
|
|
||||||
SizedBox(
|
|
||||||
height: 120,
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -131,22 +124,26 @@ class _DesktopSettingPageState extends State<DesktopSettingPage>
|
|||||||
|
|
||||||
Widget _listView({required List<_TabInfo> tabs}) {
|
Widget _listView({required List<_TabInfo> tabs}) {
|
||||||
return ListView(
|
return ListView(
|
||||||
children: tabs.map((tab) => _listItem(tab: tab)).toList(),
|
children: tabs
|
||||||
|
.asMap()
|
||||||
|
.entries
|
||||||
|
.map((tab) => _listItem(tab: tab.value, index: tab.key))
|
||||||
|
.toList(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _listItem({required _TabInfo tab}) {
|
Widget _listItem({required _TabInfo tab, required int index}) {
|
||||||
return Obx(() {
|
return Obx(() {
|
||||||
bool selected = tab.index == _selectedIndex.value;
|
bool selected = index == _selectedIndex.value;
|
||||||
return Container(
|
return Container(
|
||||||
width: _kTabWidth,
|
width: _kTabWidth,
|
||||||
height: _kTabHeight,
|
height: _kTabHeight,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (_selectedIndex.value != tab.index) {
|
if (_selectedIndex.value != index) {
|
||||||
controller.jumpToPage(tab.index);
|
controller.jumpToPage(index);
|
||||||
}
|
}
|
||||||
_selectedIndex.value = tab.index;
|
_selectedIndex.value = index;
|
||||||
},
|
},
|
||||||
child: Row(children: [
|
child: Row(children: [
|
||||||
Container(
|
Container(
|
||||||
@ -665,7 +662,7 @@ class _AboutState extends State<_About> {
|
|||||||
final version = data['version'].toString();
|
final version = data['version'].toString();
|
||||||
final linkStyle = TextStyle(decoration: TextDecoration.underline);
|
final linkStyle = TextStyle(decoration: TextDecoration.underline);
|
||||||
return ListView(children: [
|
return ListView(children: [
|
||||||
_Card(title: "About Rustdesk", children: [
|
_Card(title: "About RustDesk", children: [
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
Loading…
Reference in New Issue
Block a user