mirror of
https://github.com/foss42/apidash.git
synced 2025-08-06 13:51:20 +08:00
fix: Material theme deprecations
This commit is contained in:
@ -26,7 +26,7 @@ final kIsAndroid = !kIsWeb && Platform.isAndroid;
|
||||
final kIsMobile = !kIsWeb && (Platform.isIOS || Platform.isAndroid);
|
||||
|
||||
final kColorTransparentState =
|
||||
MaterialStateProperty.all<Color>(Colors.transparent);
|
||||
WidgetStateProperty.all<Color>(Colors.transparent);
|
||||
const kColorTransparent = Colors.transparent;
|
||||
const kColorWhite = Colors.white;
|
||||
const kColorBlack = Colors.black;
|
||||
|
@ -70,8 +70,8 @@ class EditorTitleActions extends StatelessWidget {
|
||||
message: tooltip,
|
||||
child: IconButton(
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(const EdgeInsets.all(0) + padding),
|
||||
shape: MaterialStateProperty.all(const ContinuousRectangleBorder()),
|
||||
padding: WidgetStateProperty.all(const EdgeInsets.all(0) + padding),
|
||||
shape: WidgetStateProperty.all(const ContinuousRectangleBorder()),
|
||||
),
|
||||
onPressed: onPressed,
|
||||
icon: Icon(
|
||||
|
@ -44,7 +44,7 @@ class EnvCellField extends StatelessWidget {
|
||||
),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: clrScheme.surfaceVariant,
|
||||
color: clrScheme.surfaceContainerHighest,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -19,7 +19,7 @@ class SidebarFilter extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: kBorderRadius8,
|
||||
border: Border.all(
|
||||
color: Theme.of(context).colorScheme.surfaceVariant,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
|
@ -88,7 +88,7 @@ class Dashboard extends ConsumerWidget {
|
||||
VerticalDivider(
|
||||
thickness: 1,
|
||||
width: 1,
|
||||
color: Theme.of(context).colorScheme.surfaceVariant,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
Expanded(
|
||||
child: IndexedStack(
|
||||
|
@ -177,7 +177,7 @@ class EditEnvironmentSecretsState
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
borderRadius: kBorderRadius12,
|
||||
),
|
||||
margin: kP10,
|
||||
|
@ -178,7 +178,7 @@ class EditEnvironmentVariablesState
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
borderRadius: kBorderRadius12,
|
||||
),
|
||||
margin: kP10,
|
||||
|
@ -17,11 +17,7 @@ class EditRequestBody extends ConsumerWidget {
|
||||
final contentType = ref.watch(selectedRequestModelProvider
|
||||
.select((value) => value?.httpRequestModel?.bodyContentType));
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
),
|
||||
child: Column(
|
||||
return Column(
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: kHeaderHeight,
|
||||
@ -69,7 +65,6 @@ class EditRequestBody extends ConsumerWidget {
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -201,10 +201,6 @@ class _FormDataBodyState extends ConsumerState<FormDataWidget> {
|
||||
return Stack(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
borderRadius: kBorderRadius12,
|
||||
),
|
||||
margin: kP10,
|
||||
child: Column(
|
||||
children: [
|
||||
|
@ -179,10 +179,6 @@ class EditRequestHeadersState extends ConsumerState<EditRequestHeaders> {
|
||||
return Stack(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
borderRadius: kBorderRadius12,
|
||||
),
|
||||
margin: kP10,
|
||||
child: Column(
|
||||
children: [
|
||||
|
@ -179,10 +179,6 @@ class EditRequestURLParamsState extends ConsumerState<EditRequestURLParams> {
|
||||
return Stack(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
borderRadius: kBorderRadius12,
|
||||
),
|
||||
margin: kP10,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
|
@ -12,10 +12,12 @@ class EditorPaneRequestURLCard extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
color: kColorTransparent,
|
||||
surfaceTintColor: kColorTransparent,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color: Theme.of(context).colorScheme.surfaceVariant,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
borderRadius: kBorderRadius12,
|
||||
),
|
||||
@ -32,7 +34,6 @@ class EditorPaneRequestURLCard extends StatelessWidget {
|
||||
Expanded(
|
||||
child: URLTextField(),
|
||||
),
|
||||
SizedBox.shrink(),
|
||||
],
|
||||
)
|
||||
: const Row(
|
||||
|
@ -21,9 +21,9 @@ class PageBase extends ConsumerWidget {
|
||||
final isDarkMode =
|
||||
ref.watch(settingsProvider.select((value) => value.isDark));
|
||||
final scaffold = Scaffold(
|
||||
backgroundColor: Theme.of(context).colorScheme.background,
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Theme.of(context).colorScheme.background,
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
primary: true,
|
||||
title: Text(title),
|
||||
centerTitle: true,
|
||||
|
@ -9,9 +9,11 @@ class RequestDetailsCard extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
color: kColorTransparent,
|
||||
surfaceTintColor: kColorTransparent,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color: Theme.of(context).colorScheme.surfaceVariant,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
borderRadius: kBorderRadius12,
|
||||
),
|
||||
|
@ -42,7 +42,8 @@ class SidebarEnvironmentCard extends StatelessWidget {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final Color color =
|
||||
isGlobal ? colorScheme.secondaryContainer : colorScheme.surface;
|
||||
final Color colorVariant = colorScheme.surfaceVariant.withOpacity(0.5);
|
||||
final Color colorVariant =
|
||||
colorScheme.surfaceContainerHighest.withOpacity(0.5);
|
||||
final Color surfaceTint = colorScheme.primary;
|
||||
bool isSelected = selectedId == id;
|
||||
bool inEditMode = editRequestId == id;
|
||||
|
@ -42,7 +42,7 @@ class SidebarRequestCard extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final Color color = Theme.of(context).colorScheme.surface;
|
||||
final Color colorVariant =
|
||||
Theme.of(context).colorScheme.surfaceVariant.withOpacity(0.5);
|
||||
Theme.of(context).colorScheme.surfaceContainerHighest.withOpacity(0.5);
|
||||
final Color surfaceTint = Theme.of(context).colorScheme.primary;
|
||||
bool isSelected = selectedId == id;
|
||||
bool inEditMode = editRequestId == id;
|
||||
|
@ -22,16 +22,16 @@ class CheckBox extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
),
|
||||
side: BorderSide(
|
||||
color: colorScheme.surfaceVariant,
|
||||
color: colorScheme.surfaceContainerHighest,
|
||||
width: 1.5,
|
||||
),
|
||||
splashRadius: 0,
|
||||
value: value,
|
||||
onChanged: onChanged,
|
||||
checkColor: colorScheme.onPrimary,
|
||||
fillColor: MaterialStateProperty.resolveWith<Color?>(
|
||||
(Set<MaterialState> states) {
|
||||
if (states.contains(MaterialState.selected)) {
|
||||
fillColor: WidgetStateProperty.resolveWith<Color?>(
|
||||
(Set<WidgetState> states) {
|
||||
if (states.contains(WidgetState.selected)) {
|
||||
return colorScheme.primary;
|
||||
}
|
||||
return null;
|
||||
|
@ -121,7 +121,8 @@ class ViewCodePane extends StatelessWidget {
|
||||
: Theme.of(context).colorScheme.primaryContainer)
|
||||
.withOpacity(kForegroundOpacity),
|
||||
Theme.of(context).colorScheme.surface),
|
||||
border: Border.all(color: Theme.of(context).colorScheme.surfaceVariant),
|
||||
border: Border.all(
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest),
|
||||
borderRadius: kBorderRadius8,
|
||||
);
|
||||
|
||||
|
@ -93,7 +93,7 @@ class _TextFieldEditorState extends State<TextFieldEditor> {
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: kBorderRadius8,
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).colorScheme.surfaceVariant,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
),
|
||||
filled: true,
|
||||
|
@ -110,7 +110,7 @@ class _JsonTextFieldEditorState extends State<JsonTextFieldEditor> {
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: kBorderRadius8,
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).colorScheme.surfaceVariant,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
),
|
||||
filled: true,
|
||||
|
@ -43,7 +43,7 @@ class CellField extends StatelessWidget {
|
||||
),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: clrScheme.surfaceVariant,
|
||||
color: clrScheme.surfaceContainerHighest,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -57,7 +57,7 @@ class ObscurableCellField extends HookWidget {
|
||||
),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: clrScheme.surfaceVariant,
|
||||
color: clrScheme.surfaceContainerHighest,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -93,7 +93,7 @@ class _HeaderFieldState extends State<HeaderField> {
|
||||
),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: colorScheme.surfaceVariant,
|
||||
color: colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:apidash/consts.dart';
|
||||
|
||||
class RawTextField extends StatelessWidget {
|
||||
const RawTextField({
|
||||
@ -24,6 +25,7 @@ class RawTextField extends StatelessWidget {
|
||||
isDense: true,
|
||||
border: InputBorder.none,
|
||||
hintText: hintText,
|
||||
contentPadding: kPv8,
|
||||
),
|
||||
onTapOutside: (PointerDownEvent event) {
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
|
@ -246,9 +246,11 @@ class _JsonPreviewerState extends State<JsonPreviewer> {
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
border: Border.all(
|
||||
color: Theme.of(context).colorScheme.surfaceVariant),
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.surfaceContainerHighest),
|
||||
borderRadius: kBorderRadius8,
|
||||
),
|
||||
child: Row(
|
||||
|
@ -405,7 +405,8 @@ class _BodySuccessState extends State<BodySuccess> {
|
||||
: Theme.of(context).colorScheme.primaryContainer)
|
||||
.withOpacity(kForegroundOpacity),
|
||||
Theme.of(context).colorScheme.surface),
|
||||
border: Border.all(color: Theme.of(context).colorScheme.surfaceVariant),
|
||||
border: Border.all(
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest),
|
||||
borderRadius: kBorderRadius8,
|
||||
);
|
||||
|
||||
@ -425,7 +426,7 @@ class _BodySuccessState extends State<BodySuccess> {
|
||||
? const SizedBox()
|
||||
: SegmentedButton<ResponseBodyView>(
|
||||
style: const ButtonStyle(
|
||||
padding: MaterialStatePropertyAll(
|
||||
padding: WidgetStatePropertyAll(
|
||||
EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
),
|
||||
|
@ -35,7 +35,7 @@ class DashboardSplitViewState extends State<DashboardSplitView> {
|
||||
data: MultiSplitViewThemeData(
|
||||
dividerThickness: 3,
|
||||
dividerPainter: DividerPainters.background(
|
||||
color: Theme.of(context).colorScheme.surfaceVariant,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
highlightedColor: Theme.of(context).colorScheme.outline.withOpacity(
|
||||
kHintOpacity,
|
||||
),
|
||||
|
@ -60,7 +60,7 @@ class DrawerSplitView extends StatelessWidget {
|
||||
child: IconButton(
|
||||
icon: Icon(
|
||||
rightDrawerIcon ?? Icons.arrow_forward,
|
||||
color: Theme.of(context).colorScheme.onBackground,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
onPressed: () {
|
||||
scaffoldKey.currentState!.openEndDrawer();
|
||||
|
@ -30,7 +30,7 @@ class _EqualSplitViewState extends State<EqualSplitView> {
|
||||
data: MultiSplitViewThemeData(
|
||||
dividerThickness: 3,
|
||||
dividerPainter: DividerPainters.background(
|
||||
color: Theme.of(context).colorScheme.surfaceVariant,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
highlightedColor: Theme.of(context).colorScheme.outline.withOpacity(
|
||||
kHintOpacity,
|
||||
),
|
||||
|
@ -18,7 +18,7 @@ class MapTable extends StatelessWidget {
|
||||
return Table(
|
||||
border: TableBorder(
|
||||
horizontalInside: BorderSide(
|
||||
color: Theme.of(context).colorScheme.surfaceVariant,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
),
|
||||
columnWidths: const <int, TableColumnWidth>{
|
||||
|
Reference in New Issue
Block a user