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,14 +1,9 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
|
||||
enum DiffForm { rendered, raw }
|
||||
|
||||
bool usesCupertino(BuildContext context) => usesCupertinoHost(context);
|
||||
|
||||
const diffFormLabels = <DiffForm, String>{
|
||||
DiffForm.rendered: 'Rendered',
|
||||
DiffForm.raw: 'Raw patch',
|
||||
@@ -17,10 +12,9 @@ const diffFormLabels = <DiffForm, String>{
|
||||
/// Conservatively choose between two stock controls using the current native
|
||||
/// label role and text scaler. This does not size or restyle either control.
|
||||
bool diffFormSegmentsFit(BuildContext context, double maxWidth) {
|
||||
final style = usesCupertino(context)
|
||||
? CupertinoTheme.of(context).textTheme.textStyle
|
||||
: Theme.of(context).textTheme.labelLarge ??
|
||||
DefaultTextStyle.of(context).style;
|
||||
final style =
|
||||
Theme.of(context).textTheme.labelLarge ??
|
||||
DefaultTextStyle.of(context).style;
|
||||
var widest = 0.0;
|
||||
for (final label in diffFormLabels.values) {
|
||||
final painter = TextPainter(
|
||||
@@ -40,24 +34,6 @@ Widget diffFormControl(
|
||||
required DiffForm form,
|
||||
required ValueChanged<DiffForm> onChanged,
|
||||
}) {
|
||||
if (usesCupertino(context)) {
|
||||
return CupertinoSlidingSegmentedControl<DiffForm>(
|
||||
groupValue: form,
|
||||
onValueChanged: (value) {
|
||||
if (value != null) onChanged(value);
|
||||
},
|
||||
children: {
|
||||
for (final entry in diffFormLabels.entries)
|
||||
entry.key: ConstrainedBox(
|
||||
constraints: const BoxConstraints(minHeight: 44),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6),
|
||||
child: Center(child: Text(entry.value)),
|
||||
),
|
||||
),
|
||||
},
|
||||
);
|
||||
}
|
||||
return SegmentedButton<DiffForm>(
|
||||
style: ButtonStyle(minimumSize: const WidgetStatePropertyAll(Size(0, 48))),
|
||||
segments: [
|
||||
@@ -78,34 +54,6 @@ Widget diffFormMenu(
|
||||
required DiffForm form,
|
||||
required ValueChanged<DiffForm> onChanged,
|
||||
}) {
|
||||
if (usesCupertino(context)) {
|
||||
return Semantics(
|
||||
label: 'Diff form',
|
||||
button: true,
|
||||
child: CupertinoButton(
|
||||
padding: EdgeInsets.zero,
|
||||
minimumSize: const Size(44, 44),
|
||||
onPressed: () => showCupertinoModalPopup<void>(
|
||||
context: context,
|
||||
builder: (sheetContext) => CupertinoActionSheet(
|
||||
title: const Text('Diff form'),
|
||||
actions: [
|
||||
for (final entry in diffFormLabels.entries)
|
||||
CupertinoActionSheetAction(
|
||||
isDefaultAction: entry.key == form,
|
||||
onPressed: () {
|
||||
Navigator.of(sheetContext).pop();
|
||||
onChanged(entry.key);
|
||||
},
|
||||
child: Text(entry.value),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: const Icon(CupertinoIcons.ellipsis, size: 30),
|
||||
),
|
||||
);
|
||||
}
|
||||
return IconButton(
|
||||
tooltip: 'Diff form',
|
||||
constraints: const BoxConstraints(minWidth: 48, minHeight: 48),
|
||||
|
||||
Reference in New Issue
Block a user