Veröffentlichte Quellen
Quellen als ZIP herunterladen
CH-J SM Mobile
Durchsuchen Sie Verzeichnisse und Dateien einer bestimmten Anwendungsausgabe.
CH-J / SM Mobile
175 Dateien
sm-mobile-20261016T185235Z-8e93ecc1b59a
Hinzugefügt: · Erstellt:
1
import 'package:flutter/material.dart';2
import 'package:re_editor/re_editor.dart';3
import '../../l10n/strings.dart';5
/// Find and replace bar for the editor: case sensitivity, regular6
/// expressions, previous/next, replace one or all.7
class FindPanel extends StatelessWidget implements PreferredSizeWidget {8
final CodeFindController controller;9
final bool readOnly;10
const FindPanel({11
required this.controller,12
required this.readOnly,13
super.key,14
});16
@override17
Size get preferredSize => Size(18
double.infinity,19
controller.value == null ? 0 : (controller.value!.replaceMode ? 104 : 56),20
);22
@override23
Widget build(BuildContext context) {24
final value = controller.value;25
if (value == null) return const SizedBox.shrink();26
final scheme = Theme.of(context).colorScheme;27
final result = value.result;28
final count = result == null29
? (value.option.pattern.isEmpty ? '' : '0/0')30
: '${result.index + 1}/${result.matches.length}';31
final invalidRegex =32
value.option.regex &&33
value.option.pattern.isNotEmpty &&34
value.option.regExp == null;35
Widget toggle(String label, String tooltip, bool on, VoidCallback tap) =>36
Tooltip(37
message: tooltip,38
child: InkWell(39
onTap: tap,40
borderRadius: BorderRadius.circular(6),41
child: Container(42
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 4),43
decoration: BoxDecoration(44
color: on ? scheme.primaryContainer : null,45
borderRadius: BorderRadius.circular(6),46
),47
child: Text(48
label,49
style: TextStyle(50
fontWeight: FontWeight.w600,51
color: on ? scheme.onPrimaryContainer : null,52
),53
),54
),55
),56
);57
return Material(58
color: scheme.surfaceContainerHigh,59
child: Padding(60
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),61
child: Column(62
mainAxisSize: MainAxisSize.min,63
children: [64
SizedBox(65
height: 48,66
child: Row(67
children: [68
Expanded(69
child: TextField(70
controller: controller.findInputController,71
focusNode: controller.findInputFocusNode,72
autocorrect: false,73
enableSuggestions: false,74
decoration: InputDecoration(75
isDense: true,76
hintText: context.tr('findHint'),77
errorText: invalidRegex78
? context.tr('invalidRegex')79
: null,80
suffixText: count,81
),82
onSubmitted: (_) => controller.nextMatch(),83
),84
),85
const SizedBox(width: 4),86
toggle(87
'Aa',88
context.tr('matchCase'),89
value.option.caseSensitive,90
controller.toggleCaseSensitive,91
),92
toggle(93
'.*',94
context.tr('regularExpression'),95
value.option.regex,96
controller.toggleRegex,97
),98
IconButton(99
tooltip: context.tr('previousMatch'),100
icon: const Icon(Icons.keyboard_arrow_up),101
onPressed: controller.previousMatch,102
),103
IconButton(104
tooltip: context.tr('nextMatch'),105
icon: const Icon(Icons.keyboard_arrow_down),106
onPressed: controller.nextMatch,107
),108
if (!readOnly)109
IconButton(110
tooltip: context.tr('replace'),111
icon: Icon(112
value.replaceMode113
? Icons.unfold_less114
: Icons.find_replace,115
),116
onPressed: controller.toggleMode,117
),118
IconButton(119
tooltip: context.tr('close'),120
icon: const Icon(Icons.close),121
onPressed: controller.close,122
),123
],124
),125
),126
if (value.replaceMode && !readOnly)127
SizedBox(128
height: 48,129
child: Row(130
children: [131
Expanded(132
child: TextField(133
controller: controller.replaceInputController,134
focusNode: controller.replaceInputFocusNode,135
autocorrect: false,136
enableSuggestions: false,137
decoration: InputDecoration(138
isDense: true,139
hintText: context.tr('replaceHint'),140
),141
),142
),143
TextButton(144
onPressed: controller.replaceMatch,145
child: Text(context.tr('replace')),146
),147
TextButton(148
onPressed: controller.replaceAllMatches,149
child: Text(context.tr('replaceAll')),150
),151
],152
),153
),154
],155
),156
),157
);158
}159
}SHA-256
ba53b0f4248180baa8493786a47044d622d092dc79651664f13e658d4e585bb8CH-J Proprietary Software License 1.14 · Die Quellen werden unter der CH-J Proprietary Software License 1.14 bereitgestellt. Ihre Verfügbarkeit ändert die Lizenzbedingungen nicht und gewährt keine zusätzlichen Rechte.
SHA-256 des Archivs
46e427a43e87af091004f36145590bda8fe90086dfb0f631afeb5029fb0b5655