79 lines
2.4 KiB
Dart
79 lines
2.4 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:pipelines_app/features/pipelines/screen.dart';
|
|
|
|
import 'pipelines_probe_fixture.dart';
|
|
|
|
/// Browser fixture for the pipeline detail's real Graph tab.
|
|
///
|
|
/// `style=cupertino` selects the Cupertino host, `dark=1` its dark theme and
|
|
/// `scale=2` a real 2x text scale. The screen, its list, detail, Graph tab and
|
|
/// definition pane are the same widgets the app registers; only the replies
|
|
/// come from the in-memory fixture.
|
|
void main() {
|
|
final parameters = Uri.base.queryParameters;
|
|
runApp(
|
|
_PipelineGraphTabProbe(
|
|
cupertino: parameters['style'] == 'cupertino',
|
|
dark: parameters['dark'] == '1',
|
|
scale: double.tryParse(parameters['scale'] ?? '') ?? 1,
|
|
),
|
|
);
|
|
}
|
|
|
|
class _PipelineGraphTabProbe extends StatelessWidget {
|
|
const _PipelineGraphTabProbe({
|
|
required this.cupertino,
|
|
required this.dark,
|
|
required this.scale,
|
|
});
|
|
|
|
final bool cupertino;
|
|
final bool dark;
|
|
final double scale;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Widget scaled(BuildContext context, Widget? child) => MediaQuery(
|
|
data: MediaQuery.of(
|
|
context,
|
|
).copyWith(textScaler: TextScaler.linear(scale)),
|
|
child: child ?? const SizedBox.shrink(),
|
|
);
|
|
final screen = PipelinesScreen(
|
|
gateway: PipelinesProbeGateway(),
|
|
embedded: true,
|
|
);
|
|
if (cupertino) {
|
|
return CupertinoApp(
|
|
title: 'Pipeline graph fixture',
|
|
debugShowCheckedModeBanner: false,
|
|
theme: CupertinoThemeData(
|
|
brightness: dark ? Brightness.dark : Brightness.light,
|
|
),
|
|
builder: scaled,
|
|
// The application shell owns the navigation bar; the probe keeps the
|
|
// same embedded screen inside a host-native page instead of adding a
|
|
// second bar that would overlay the detail header.
|
|
home: CupertinoPageScaffold(child: SafeArea(child: screen)),
|
|
);
|
|
}
|
|
return MaterialApp(
|
|
title: 'Pipeline graph fixture',
|
|
debugShowCheckedModeBanner: false,
|
|
theme: ThemeData(
|
|
platform: TargetPlatform.android,
|
|
brightness: Brightness.light,
|
|
),
|
|
darkTheme: ThemeData(
|
|
platform: TargetPlatform.android,
|
|
brightness: Brightness.dark,
|
|
),
|
|
themeMode: dark ? ThemeMode.dark : ThemeMode.light,
|
|
builder: scaled,
|
|
home: Scaffold(body: SafeArea(child: screen)),
|
|
);
|
|
}
|
|
}
|