CH-J SM Mobileการจัดการเซิร์ฟเวอร์ผ่าน SSH
เมนู
ซอร์สที่เผยแพร่

CH-J SM Mobile

เรียกดูไดเรกทอรีและไฟล์ของรุ่นแอปพลิเคชันที่ระบุ

ดาวน์โหลด ZIP ของซอร์ส
CH-J / SM Mobile 175 ไฟล์
sm-mobile-20261016T185235Z-8e93ecc1b59a วันที่เพิ่ม: · วันที่บิลด์:
find_panel.dart วันที่เพิ่ม: ไม่ได้บันทึกวันที่ 5.6 KB · 159 บรรทัด
โค้ด ดาวน์โหลดไฟล์
1import 'package:flutter/material.dart';
2import 'package:re_editor/re_editor.dart';
3import '../../l10n/strings.dart';
5/// Find and replace bar for the editor: case sensitivity, regular
6/// expressions, previous/next, replace one or all.
7class 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 @override
17 Size get preferredSize => Size(
18 double.infinity,
19 controller.value == null ? 0 : (controller.value!.replaceMode ? 104 : 56),
20 );
22 @override
23 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 == null
29 ? (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: invalidRegex
78 ? 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.replaceMode
113 ? Icons.unfold_less
114 : 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 }
SHA-256ba53b0f4248180baa8493786a47044d622d092dc79651664f13e658d4e585bb8

CH-J Proprietary Software License 1.14 · ซอร์สโค้ดนี้ให้ไว้ภายใต้ CH-J Proprietary Software License 1.14 การเปิดให้เข้าถึงไม่ได้เปลี่ยนแปลงเงื่อนไขของสัญญาอนุญาตหรือให้สิทธิ์เพิ่มเติม

SHA-256 ของไฟล์บีบอัด46e427a43e87af091004f36145590bda8fe90086dfb0f631afeb5029fb0b5655
ไฟล์