Update widgets UI as per the latest Material 3 colors

This commit is contained in:
Ashita Prasad
2025-03-01 19:45:40 +05:30
parent b4827dc2c5
commit 32210e60cc
16 changed files with 30 additions and 76 deletions

View File

@ -21,8 +21,7 @@ class HistoryRequestCard extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final Color color = Theme.of(context).colorScheme.surface; final Color color = Theme.of(context).colorScheme.surface;
final Color colorVariant = final Color colorVariant = Theme.of(context).colorScheme.surfaceContainer;
Theme.of(context).colorScheme.surfaceContainerHighest.withOpacity(0.5);
final Color surfaceTint = Theme.of(context).colorScheme.primary; final Color surfaceTint = Theme.of(context).colorScheme.primary;
return Card( return Card(
shape: const ContinuousRectangleBorder(borderRadius: kBorderRadius12), shape: const ContinuousRectangleBorder(borderRadius: kBorderRadius12),
@ -38,7 +37,6 @@ class HistoryRequestCard extends StatelessWidget {
onTap: onTap, onTap: onTap,
borderRadius: kBorderRadius6, borderRadius: kBorderRadius6,
hoverColor: colorVariant, hoverColor: colorVariant,
focusColor: colorVariant.withOpacity(0.5),
child: Padding( child: Padding(
padding: kPv6 + kPh8, padding: kPv6 + kPh8,
child: SizedBox( child: SizedBox(

View File

@ -43,8 +43,7 @@ class SidebarEnvironmentCard extends StatelessWidget {
final colorScheme = Theme.of(context).colorScheme; final colorScheme = Theme.of(context).colorScheme;
final Color color = final Color color =
isGlobal ? colorScheme.secondaryContainer : colorScheme.surface; isGlobal ? colorScheme.secondaryContainer : colorScheme.surface;
final Color colorVariant = final Color colorVariant = colorScheme.surfaceContainer;
colorScheme.surfaceContainerHighest.withOpacity(0.5);
final Color surfaceTint = colorScheme.primary; final Color surfaceTint = colorScheme.primary;
bool isSelected = selectedId == id; bool isSelected = selectedId == id;
bool inEditMode = editRequestId == id; bool inEditMode = editRequestId == id;
@ -68,7 +67,7 @@ class SidebarEnvironmentCard extends StatelessWidget {
child: InkWell( child: InkWell(
borderRadius: kBorderRadius8, borderRadius: kBorderRadius8,
hoverColor: colorVariant, hoverColor: colorVariant,
focusColor: colorVariant.withOpacity(0.5), focusColor: colorVariant,
onTap: inEditMode ? null : onTap, onTap: inEditMode ? null : onTap,
// onSecondaryTap: onSecondaryTap, // onSecondaryTap: onSecondaryTap,
onSecondaryTapUp: (isGlobal) onSecondaryTapUp: (isGlobal)

View File

@ -28,8 +28,7 @@ class SidebarHistoryCard extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final Color color = Theme.of(context).colorScheme.surface; final Color color = Theme.of(context).colorScheme.surface;
final Color colorVariant = final Color colorVariant = Theme.of(context).colorScheme.surfaceContainer;
Theme.of(context).colorScheme.surfaceContainerHighest.withOpacity(0.5);
final model = models.first; final model = models.first;
final Color surfaceTint = Theme.of(context).colorScheme.primary; final Color surfaceTint = Theme.of(context).colorScheme.primary;
final String name = getHistoryRequestName(model); final String name = getHistoryRequestName(model);
@ -53,7 +52,6 @@ class SidebarHistoryCard extends StatelessWidget {
onTap: onTap, onTap: onTap,
borderRadius: kBorderRadius8, borderRadius: kBorderRadius8,
hoverColor: colorVariant, hoverColor: colorVariant,
focusColor: colorVariant.withOpacity(0.5),
child: Padding( child: Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
left: 6, left: 6,

View File

@ -45,8 +45,7 @@ class SidebarRequestCard extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final Color color = Theme.of(context).colorScheme.surface; final Color color = Theme.of(context).colorScheme.surface;
final Color colorVariant = final Color colorVariant = Theme.of(context).colorScheme.surfaceContainer;
Theme.of(context).colorScheme.surfaceContainerHighest.withOpacity(0.5);
final Color surfaceTint = Theme.of(context).colorScheme.primary; final Color surfaceTint = Theme.of(context).colorScheme.primary;
bool isSelected = selectedId == id; bool isSelected = selectedId == id;
bool inEditMode = editRequestId == id; bool inEditMode = editRequestId == id;
@ -72,7 +71,7 @@ class SidebarRequestCard extends StatelessWidget {
child: InkWell( child: InkWell(
borderRadius: kBorderRadius8, borderRadius: kBorderRadius8,
hoverColor: colorVariant, hoverColor: colorVariant,
focusColor: colorVariant.withOpacity(0.5), focusColor: colorVariant,
onTap: inEditMode ? null : onTap, onTap: inEditMode ? null : onTap,
// onDoubleTap: inEditMode ? null : onDoubleTap, // onDoubleTap: inEditMode ? null : onDoubleTap,
onSecondaryTapUp: (details) { onSecondaryTapUp: (details) {

View File

@ -118,12 +118,7 @@ class ViewCodePane extends StatelessWidget {
? kLightCodeTheme ? kLightCodeTheme
: kDarkCodeTheme; : kDarkCodeTheme;
final textContainerdecoration = BoxDecoration( final textContainerdecoration = BoxDecoration(
color: Color.alphaBlend( color: Theme.of(context).colorScheme.surfaceContainerLow,
(Theme.of(context).brightness == Brightness.dark
? Theme.of(context).colorScheme.onPrimaryContainer
: Theme.of(context).colorScheme.primaryContainer)
.withOpacity(kForegroundOpacity),
Theme.of(context).colorScheme.surface),
border: Border.all( border: Border.all(
color: Theme.of(context).colorScheme.surfaceContainerHighest), color: Theme.of(context).colorScheme.surfaceContainerHighest),
borderRadius: kBorderRadius8, borderRadius: kBorderRadius8,

View File

@ -29,10 +29,7 @@ showHistoryRetentionDialog(
child: Text( child: Text(
"Select the duration for which you want to retain your request history", "Select the duration for which you want to retain your request history",
style: Theme.of(context).textTheme.bodyMedium?.copyWith( style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Theme.of(context) color: Theme.of(context).colorScheme.outline,
.colorScheme
.onSurface
.withOpacity(0.8),
), ),
), ),
), ),
@ -49,10 +46,7 @@ showHistoryRetentionDialog(
secondary: Icon(e.icon, secondary: Icon(e.icon,
color: selectedRetentionPeriod == e color: selectedRetentionPeriod == e
? Theme.of(context).colorScheme.primary ? Theme.of(context).colorScheme.primary
: Theme.of(context) : Theme.of(context).colorScheme.outline),
.colorScheme
.onSurface
.withOpacity(0.6)),
value: e, value: e,
groupValue: selectedRetentionPeriod, groupValue: selectedRetentionPeriod,
onChanged: (value) { onChanged: (value) {

View File

@ -86,16 +86,12 @@ class _TextFieldEditorState extends State<TextFieldEditor> {
decoration: InputDecoration( decoration: InputDecoration(
hintText: widget.hintText ?? kHintContent, hintText: widget.hintText ?? kHintContent,
hintStyle: TextStyle( hintStyle: TextStyle(
color: Theme.of(context).colorScheme.outline.withOpacity( color: Theme.of(context).colorScheme.outlineVariant,
kHintOpacity,
),
), ),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderRadius: kBorderRadius8, borderRadius: kBorderRadius8,
borderSide: BorderSide( borderSide: BorderSide(
color: Theme.of(context).colorScheme.primary.withOpacity( color: Theme.of(context).colorScheme.outlineVariant,
kHintOpacity,
),
), ),
), ),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
@ -106,12 +102,7 @@ class _TextFieldEditorState extends State<TextFieldEditor> {
), ),
filled: true, filled: true,
hoverColor: kColorTransparent, hoverColor: kColorTransparent,
fillColor: Color.alphaBlend( fillColor: Theme.of(context).colorScheme.surfaceContainerLow,
(Theme.of(context).brightness == Brightness.dark
? Theme.of(context).colorScheme.onPrimaryContainer
: Theme.of(context).colorScheme.primaryContainer)
.withOpacity(kForegroundOpacity),
Theme.of(context).colorScheme.surface),
), ),
), ),
); );

View File

@ -80,15 +80,12 @@ class _HeaderFieldState extends State<HeaderField> {
color: colorScheme.onSurface, color: colorScheme.onSurface,
), ),
decoration: InputDecoration( decoration: InputDecoration(
hintStyle: kCodeStyle.copyWith( hintStyle: kCodeStyle.copyWith(color: colorScheme.outlineVariant),
color: colorScheme.outline.withOpacity(kHintOpacity)),
hintText: widget.hintText, hintText: widget.hintText,
contentPadding: const EdgeInsets.only(bottom: 12), contentPadding: const EdgeInsets.only(bottom: 12),
focusedBorder: UnderlineInputBorder( focusedBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: colorScheme.primary.withOpacity( color: colorScheme.outline,
kHintOpacity,
),
), ),
), ),
enabledBorder: UnderlineInputBorder( enabledBorder: UnderlineInputBorder(

View File

@ -25,9 +25,7 @@ class URLField extends StatelessWidget {
decoration: InputDecoration( decoration: InputDecoration(
hintText: kHintTextUrlCard, hintText: kHintTextUrlCard,
hintStyle: kCodeStyle.copyWith( hintStyle: kCodeStyle.copyWith(
color: Theme.of(context).colorScheme.outline.withOpacity( color: Theme.of(context).colorScheme.outlineVariant,
kHintOpacity,
),
), ),
border: InputBorder.none, border: InputBorder.none,
), ),

View File

@ -405,14 +405,10 @@ class _BodySuccessState extends State<BodySuccess> {
? kLightCodeTheme ? kLightCodeTheme
: kDarkCodeTheme; : kDarkCodeTheme;
final textContainerdecoration = BoxDecoration( final textContainerdecoration = BoxDecoration(
color: Color.alphaBlend( color: Theme.of(context).colorScheme.surfaceContainerLow,
(Theme.of(context).brightness == Brightness.dark
? Theme.of(context).colorScheme.onPrimaryContainer
: Theme.of(context).colorScheme.primaryContainer)
.withOpacity(kForegroundOpacity),
Theme.of(context).colorScheme.surface),
border: Border.all( border: Border.all(
color: Theme.of(context).colorScheme.surfaceContainerHighest), color: Theme.of(context).colorScheme.surfaceContainerHighest,
),
borderRadius: kBorderRadius8, borderRadius: kBorderRadius8,
); );

View File

@ -1,4 +1,3 @@
import 'package:apidash_design_system/apidash_design_system.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:multi_split_view/multi_split_view.dart'; import 'package:multi_split_view/multi_split_view.dart';
@ -35,10 +34,9 @@ class DashboardSplitViewState extends State<DashboardSplitView> {
data: MultiSplitViewThemeData( data: MultiSplitViewThemeData(
dividerThickness: 3, dividerThickness: 3,
dividerPainter: DividerPainters.background( dividerPainter: DividerPainters.background(
color: Theme.of(context).colorScheme.surfaceContainerHighest, color: Theme.of(context).colorScheme.surfaceContainer,
highlightedColor: Theme.of(context).colorScheme.outline.withOpacity( highlightedColor:
kHintOpacity, Theme.of(context).colorScheme.surfaceContainerHighest,
),
animationEnabled: false, animationEnabled: false,
), ),
), ),

View File

@ -1,4 +1,3 @@
import 'package:apidash_design_system/apidash_design_system.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:multi_split_view/multi_split_view.dart'; import 'package:multi_split_view/multi_split_view.dart';
@ -30,10 +29,9 @@ class EqualSplitView extends StatelessWidget {
data: MultiSplitViewThemeData( data: MultiSplitViewThemeData(
dividerThickness: 3, dividerThickness: 3,
dividerPainter: DividerPainters.background( dividerPainter: DividerPainters.background(
color: Theme.of(context).colorScheme.surfaceContainerHighest, color: Theme.of(context).colorScheme.surfaceContainer,
highlightedColor: Theme.of(context).colorScheme.outline.withOpacity( highlightedColor:
kHintOpacity, Theme.of(context).colorScheme.surfaceContainerHighest,
),
animationEnabled: false, animationEnabled: false,
), ),
), ),

View File

@ -1,4 +1,3 @@
import 'package:apidash_design_system/apidash_design_system.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:multi_split_view/multi_split_view.dart'; import 'package:multi_split_view/multi_split_view.dart';
@ -35,10 +34,9 @@ class HistorySplitViewState extends State<HistorySplitView> {
data: MultiSplitViewThemeData( data: MultiSplitViewThemeData(
dividerThickness: 3, dividerThickness: 3,
dividerPainter: DividerPainters.background( dividerPainter: DividerPainters.background(
color: Theme.of(context).colorScheme.surfaceContainerHighest, color: Theme.of(context).colorScheme.surfaceContainer,
highlightedColor: Theme.of(context).colorScheme.outline.withOpacity( highlightedColor:
kHintOpacity, Theme.of(context).colorScheme.surfaceContainerHighest,
),
animationEnabled: false, animationEnabled: false,
), ),
), ),

View File

@ -35,8 +35,7 @@ class SegmentedTabbar extends StatelessWidget {
dividerColor: Colors.transparent, dividerColor: Colors.transparent,
indicatorWeight: 0.0, indicatorWeight: 0.0,
indicatorSize: TabBarIndicatorSize.tab, indicatorSize: TabBarIndicatorSize.tab,
unselectedLabelColor: unselectedLabelColor: Theme.of(context).colorScheme.outline,
Theme.of(context).colorScheme.onSurface.withOpacity(0.4),
labelStyle: kTextStyleTab.copyWith( labelStyle: kTextStyleTab.copyWith(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.onPrimary, color: Theme.of(context).colorScheme.onPrimary,

View File

@ -45,9 +45,7 @@ class RequestDataTable extends StatelessWidget {
contentPadding: const EdgeInsets.only(bottom: 12), contentPadding: const EdgeInsets.only(bottom: 12),
focusedBorder: UnderlineInputBorder( focusedBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: clrScheme.primary.withOpacity( color: clrScheme.outlineVariant,
kHintOpacity,
),
), ),
), ),
enabledBorder: UnderlineInputBorder( enabledBorder: UnderlineInputBorder(

View File

@ -47,9 +47,7 @@ class RequestFormDataTable extends StatelessWidget {
contentPadding: const EdgeInsets.only(bottom: 12), contentPadding: const EdgeInsets.only(bottom: 12),
focusedBorder: UnderlineInputBorder( focusedBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: clrScheme.primary.withOpacity( color: clrScheme.outlineVariant,
kHintOpacity,
),
), ),
), ),
enabledBorder: UnderlineInputBorder( enabledBorder: UnderlineInputBorder(