feat(app): add run change captures and native diff viewer
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// The two platform hosts the Changes widget tests share: Material for
|
||||
/// Android/desktop/web and Cupertino for iOS/macOS. They state the platform
|
||||
/// explicitly instead of mutating a global debug override.
|
||||
Widget materialHost(
|
||||
Widget child, {
|
||||
TextScaler scaler = TextScaler.noScaling,
|
||||
Brightness brightness = Brightness.light,
|
||||
}) {
|
||||
return MaterialApp(
|
||||
theme: ThemeData(brightness: brightness),
|
||||
builder: (context, app) => MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(textScaler: scaler),
|
||||
child: app!,
|
||||
),
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
Widget cupertinoHost(
|
||||
Widget child, {
|
||||
TextScaler scaler = TextScaler.noScaling,
|
||||
Brightness brightness = Brightness.light,
|
||||
}) {
|
||||
return CupertinoApp(
|
||||
theme: CupertinoThemeData(brightness: brightness),
|
||||
builder: (context, app) => Theme(
|
||||
// The real app selects Cupertino by platform; the test host states it
|
||||
// explicitly without changing a global debug override. The Theme wraps
|
||||
// the Navigator so dialogs opened later resolve the same platform.
|
||||
data: ThemeData(platform: TargetPlatform.iOS),
|
||||
child: MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(textScaler: scaler),
|
||||
child: app!,
|
||||
),
|
||||
),
|
||||
home: CupertinoPageScaffold(child: SafeArea(child: child)),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user