@@ -5,7 +5,6 @@ import 'package:flutter/material.dart';
55import 'package:flutter/services.dart' ;
66import 'package:hotkey_manager/hotkey_manager.dart' ;
77import 'package:hotkey_manager_example/widgets/record_hotkey_dialog.dart' ;
8- import 'package:preference_list/preference_list.dart' ;
98
109class ExampleIntent extends Intent {}
1110
@@ -73,77 +72,61 @@ class _HomePageState extends State<HomePage> {
7372 }
7473
7574 Widget _buildBody (BuildContext context) {
76- return PreferenceList (
75+ return ListView (
7776 children: < Widget > [
78- PreferenceListSection (
79- title: const Text ('REGISTERED HOTKEY LIST' ),
80- children: [
81- for (var registeredHotKey in _registeredHotKeyList)
82- PreferenceListItem (
83- padding: const EdgeInsets .all (12 ),
84- title: Row (
77+ const Text ('REGISTERED HOTKEY LIST' ),
78+ for (var registeredHotKey in _registeredHotKeyList)
79+ ListTile (
80+ title: Row (
81+ mainAxisSize: MainAxisSize .min,
82+ children: [
83+ HotKeyVirtualView (hotKey: registeredHotKey),
84+ const SizedBox (width: 10 ),
85+ Text (
86+ registeredHotKey.scope.toString (),
87+ style: const TextStyle (
88+ color: Colors .grey,
89+ fontSize: 12 ,
90+ ),
91+ ),
92+ ],
93+ ),
94+ trailing: SizedBox (
95+ width: 40 ,
96+ height: 40 ,
97+ child: CupertinoButton (
98+ padding: EdgeInsets .zero,
99+ child: const Stack (
100+ alignment: Alignment .center,
85101 children: [
86- HotKeyVirtualView (hotKey: registeredHotKey),
87- const SizedBox (width: 10 ),
88- Text (
89- registeredHotKey.scope.toString (),
90- style: const TextStyle (
91- color: Colors .grey,
92- fontSize: 12 ,
93- ),
102+ Icon (
103+ CupertinoIcons .delete,
104+ size: 18 ,
105+ color: Colors .red,
94106 ),
95107 ],
96108 ),
97- accessoryView: SizedBox (
98- width: 40 ,
99- height: 40 ,
100- child: CupertinoButton (
101- padding: EdgeInsets .zero,
102- child: const Stack (
103- alignment: Alignment .center,
104- children: [
105- Icon (
106- CupertinoIcons .delete,
107- size: 18 ,
108- color: Colors .red,
109- ),
110- ],
111- ),
112- onPressed: () => _handleHotKeyUnregister (registeredHotKey),
113- ),
114- ),
115- ),
116- PreferenceListItem (
117- title: Text (
118- 'Register a new HotKey' ,
119- style: TextStyle (
120- color: Theme .of (context).primaryColor,
121- ),
109+ onPressed: () => _handleHotKeyUnregister (registeredHotKey),
122110 ),
123- accessoryView: Container (),
124- onTap: () {
125- _handleClickRegisterNewHotKey ();
126- },
127111 ),
128- ],
112+ ),
113+ ListTile (
114+ title: const Text (
115+ 'Register a new HotKey' ,
116+ ),
117+ onTap: () {
118+ _handleClickRegisterNewHotKey ();
119+ },
129120 ),
130- PreferenceListSection (
131- children: [
132- PreferenceListItem (
133- title: Text (
134- 'Unregister all HotKeys' ,
135- style: TextStyle (
136- color: Theme .of (context).primaryColor,
137- ),
138- ),
139- accessoryView: Container (),
140- onTap: () async {
141- await hotKeyManager.unregisterAll ();
142- _registeredHotKeyList = hotKeyManager.registeredHotKeyList;
143- setState (() {});
144- },
145- ),
146- ],
121+ ListTile (
122+ title: const Text (
123+ 'Unregister all HotKeys' ,
124+ ),
125+ onTap: () async {
126+ await hotKeyManager.unregisterAll ();
127+ _registeredHotKeyList = hotKeyManager.registeredHotKeyList;
128+ setState (() {});
129+ },
147130 ),
148131 ],
149132 );
0 commit comments