Remove Cupertino changes branches
Keep the Material-only changes feature while preserving public Cupertino parameters for callers. Remove Cupertino-only widgets, imports, hosts, and tests because the app never reaches that path.
This commit is contained in:
@@ -1,74 +1,32 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'change_style.dart';
|
||||
|
||||
/// The recorded raw patch bytes, one recorded line per line, in the host's own
|
||||
/// selectable body.
|
||||
/// The recorded raw patch bytes, one recorded line per line, in a selectable
|
||||
/// body.
|
||||
///
|
||||
/// Material uses [SelectionArea]; a Cupertino host has no
|
||||
/// [MaterialLocalizations], so it renders the same text in the read-only
|
||||
/// [CupertinoTextField] the run detail already uses for plain selectable text.
|
||||
/// Both forms keep their intrinsic line width, so long lines scroll sideways
|
||||
/// The text keeps its intrinsic line width, so long lines scroll sideways
|
||||
/// instead of wrapping a continuation under a new line.
|
||||
class RawPatchView extends StatefulWidget {
|
||||
class RawPatchView extends StatelessWidget {
|
||||
const RawPatchView({super.key, required this.patch, required this.style});
|
||||
|
||||
final String patch;
|
||||
final TextStyle style;
|
||||
|
||||
@override
|
||||
State<RawPatchView> createState() => _RawPatchViewState();
|
||||
}
|
||||
|
||||
class _RawPatchViewState extends State<RawPatchView> {
|
||||
late final TextEditingController _text = TextEditingController(
|
||||
text: widget.patch,
|
||||
);
|
||||
|
||||
@override
|
||||
void didUpdateWidget(RawPatchView oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (widget.patch != _text.text) _text.text = widget.patch;
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_text.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = usesCupertino(context);
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: cupertino
|
||||
? IntrinsicWidth(
|
||||
child: ExcludeSemantics(
|
||||
child: CupertinoTextField(
|
||||
key: const ValueKey('raw-patch-field'),
|
||||
controller: _text,
|
||||
readOnly: true,
|
||||
maxLines: null,
|
||||
padding: EdgeInsets.zero,
|
||||
decoration: const BoxDecoration(),
|
||||
style: widget.style,
|
||||
),
|
||||
),
|
||||
)
|
||||
: ExcludeSemantics(
|
||||
child: SelectionArea(
|
||||
child: Text(
|
||||
widget.patch,
|
||||
style: widget.style,
|
||||
softWrap: false,
|
||||
overflow: TextOverflow.visible,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: ExcludeSemantics(
|
||||
child: SelectionArea(
|
||||
child: Text(
|
||||
patch,
|
||||
style: style,
|
||||
softWrap: false,
|
||||
overflow: TextOverflow.visible,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user