| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -8,6 +8,7 @@ import 'package:dde_gesture_manager/models/settings.provider.dart';
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import 'package:dde_gesture_manager/widgets/dde_button.dart';
 | 
					 | 
					 | 
					 | 
					import 'package:dde_gesture_manager/widgets/dde_button.dart';
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import 'package:flutter/animation.dart';
 | 
					 | 
					 | 
					 | 
					import 'package:flutter/animation.dart';
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import 'package:flutter/cupertino.dart';
 | 
					 | 
					 | 
					 | 
					import 'package:flutter/cupertino.dart';
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import 'package:flutter/foundation.dart';
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import 'package:flutter/material.dart';
 | 
					 | 
					 | 
					 | 
					import 'package:flutter/material.dart';
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import 'package:flutter/painting.dart';
 | 
					 | 
					 | 
					 | 
					import 'package:flutter/painting.dart';
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import 'package:uuid/uuid.dart';
 | 
					 | 
					 | 
					 | 
					import 'package:uuid/uuid.dart';
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -24,21 +25,21 @@ class LocalManager extends StatefulWidget {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					class _LocalManagerState extends State<LocalManager> {
 | 
					 | 
					 | 
					 | 
					class _LocalManagerState extends State<LocalManager> {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  late ScrollController _scrollController;
 | 
					 | 
					 | 
					 | 
					  late ScrollController _scrollController;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  String? _hoveringItem;
 | 
					 | 
					 | 
					 | 
					  String? _hoveringItem;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  late String _selectedItem;
 | 
					 | 
					 | 
					 | 
					  late String _selectedItemPath;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  @override
 | 
					 | 
					 | 
					 | 
					  @override
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  void initState() {
 | 
					 | 
					 | 
					 | 
					  void initState() {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    super.initState();
 | 
					 | 
					 | 
					 | 
					    super.initState();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /// todo: load from sp
 | 
					 | 
					 | 
					 | 
					    /// todo: load from sp
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    _selectedItem = Uuid.NAMESPACE_NIL;
 | 
					 | 
					 | 
					 | 
					    _selectedItemPath = '';
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    _scrollController = ScrollController();
 | 
					 | 
					 | 
					 | 
					    _scrollController = ScrollController();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  }
 | 
					 | 
					 | 
					 | 
					  }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  Color _getItemBackgroundColor(int index, String itemId) {
 | 
					 | 
					 | 
					 | 
					  Color _getItemBackgroundColor(int index, String itemPath) {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    Color _color = index % 2 == 0 ? context.t.scaffoldBackgroundColor : context.t.backgroundColor;
 | 
					 | 
					 | 
					 | 
					    Color _color = index % 2 == 0 ? context.t.scaffoldBackgroundColor : context.t.backgroundColor;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (itemId == _hoveringItem) _color = context.t.scaffoldBackgroundColor;
 | 
					 | 
					 | 
					 | 
					    if (itemPath == _hoveringItem) _color = context.t.scaffoldBackgroundColor;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (itemId == _selectedItem) _color = context.read<SettingsProvider>().currentActiveColor;
 | 
					 | 
					 | 
					 | 
					    if (itemPath == _selectedItemPath) _color = context.read<SettingsProvider>().currentActiveColor;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return _color;
 | 
					 | 
					 | 
					 | 
					    return _color;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  }
 | 
					 | 
					 | 
					 | 
					  }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -111,7 +112,7 @@ class _LocalManagerState extends State<LocalManager> {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                  onTap: () {
 | 
					 | 
					 | 
					 | 
					                                  onTap: () {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                    context.read<SchemeProvider>().copyFrom(localSchemes[index].scheme);
 | 
					 | 
					 | 
					 | 
					                                    context.read<SchemeProvider>().copyFrom(localSchemes[index].scheme);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                    setState(() {
 | 
					 | 
					 | 
					 | 
					                                    setState(() {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                      _selectedItem = localSchemes[index].scheme.id!;
 | 
					 | 
					 | 
					 | 
					                                      _selectedItemPath = localSchemes[index].path;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                    });
 | 
					 | 
					 | 
					 | 
					                                    });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                    context.read<GesturePropProvider>().copyFrom(GestureProp.empty());
 | 
					 | 
					 | 
					 | 
					                                    context.read<GesturePropProvider>().copyFrom(GestureProp.empty());
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                  },
 | 
					 | 
					 | 
					 | 
					                                  },
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -123,13 +124,12 @@ class _LocalManagerState extends State<LocalManager> {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                      });
 | 
					 | 
					 | 
					 | 
					                                      });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                    },
 | 
					 | 
					 | 
					 | 
					                                    },
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                    child: Container(
 | 
					 | 
					 | 
					 | 
					                                    child: Container(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                      color: _getItemBackgroundColor(index, localSchemes[index].scheme.id!),
 | 
					 | 
					 | 
					 | 
					                                      color: _getItemBackgroundColor(index, localSchemes[index].path),
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                      child: Padding(
 | 
					 | 
					 | 
					 | 
					                                      child: Padding(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                        padding: const EdgeInsets.only(left: 6, right: 12.0),
 | 
					 | 
					 | 
					 | 
					                                        padding: const EdgeInsets.only(left: 6, right: 12.0),
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                        child: DefaultTextStyle(
 | 
					 | 
					 | 
					 | 
					                                        child: DefaultTextStyle(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                          style: context.t.textTheme.bodyText2!.copyWith(
 | 
					 | 
					 | 
					 | 
					                                          style: context.t.textTheme.bodyText2!.copyWith(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                            color:
 | 
					 | 
					 | 
					 | 
					                                            color: _selectedItemPath == localSchemes[index].path ? Colors.white : null,
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                                _selectedItem == localSchemes[index].scheme.id! ? Colors.white : null,
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                          ),
 | 
					 | 
					 | 
					 | 
					                                          ),
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                          child: Row(
 | 
					 | 
					 | 
					 | 
					                                          child: Row(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
 | 
					 | 
					 | 
					 | 
					                                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -153,10 +153,31 @@ class _LocalManagerState extends State<LocalManager> {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                          child: Row(
 | 
					 | 
					 | 
					 | 
					                          child: Row(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            mainAxisAlignment: MainAxisAlignment.end,
 | 
					 | 
					 | 
					 | 
					                            mainAxisAlignment: MainAxisAlignment.end,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            children: [
 | 
					 | 
					 | 
					 | 
					                            children: [
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                              DButton.add(enabled: true),
 | 
					 | 
					 | 
					 | 
					                              DButton.add(
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                              DButton.delete(enabled: _selectedItem != Uuid.NAMESPACE_NIL),
 | 
					 | 
					 | 
					 | 
					                                enabled: true,
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                              DButton.duplicate(enabled: _selectedItem != Uuid.NAMESPACE_NIL),
 | 
					 | 
					 | 
					 | 
					                                onTap: () async {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                              DButton.apply(enabled: _selectedItem != Uuid.NAMESPACE_NIL),
 | 
					 | 
					 | 
					 | 
					                                  var localSchemesProvider = context.read<LocalSchemesProvider>();
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                  var newSchemes = [...?localSchemesProvider.schemes];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                  newSchemes.add(await localSchemesProvider.create());
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                  localSchemesProvider.setProps(schemes: newSchemes..sort());
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                },
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                              ),
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                              DButton.delete(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                enabled: _selectedItemPath.notNull,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                onTap: () {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                  var localSchemesProvider = context.read<LocalSchemesProvider>();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                  var newSchemes = [...?localSchemesProvider.schemes];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                  var index = newSchemes.indexWhere((element) => element.path == _selectedItemPath);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                  newSchemes.removeAt(index);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                  localSchemesProvider.setProps(schemes: newSchemes);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                  localSchemesProvider.remove(_selectedItemPath);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                  setState(() {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                    _selectedItemPath = newSchemes[(index - 1).clamp(1, newSchemes.length)].path;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                  });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                },
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                              ),
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                              DButton.duplicate(enabled: _selectedItemPath.notNull),
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                              DButton.apply(enabled: _selectedItemPath.notNull),
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            ]
 | 
					 | 
					 | 
					 | 
					                            ]
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                .map((e) => Padding(
 | 
					 | 
					 | 
					 | 
					                                .map((e) => Padding(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                      padding: const EdgeInsets.only(right: 4),
 | 
					 | 
					 | 
					 | 
					                                      padding: const EdgeInsets.only(right: 4),
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |