我在为我的应用程序的scaffold创建主题时遇到了两个主要问题:
首先看一下应用程序栏,你可以看到它的颜色与支架不同(有点像我的不透明原色),尽管我把它设计得像支架。第二个问题是,在脚手架的底部有一个没有样式化的部分(可能是因为我使用了SafeAreaidk)。
下面是我使用的主题数据:
ThemeData = ThemeData(
useMaterial3: true,
colorScheme: const ColorScheme(
brightness: Brightness.light,
primary: Color.fromRGBO(248, 95, 106, 1),
onPrimary: Colors.white,
secondary: Color.fromRGBO(167, 183, 216, 1),
onSecondary: Colors.white,
error: Colors.red,
onError: Colors.white,
background: Color.fromARGB(240, 252, 251, 244),
onBackground: Colors.black,
surface: Colors.black45,
onSurface: Colors.black,
),
);
下面是屏幕的代码:
import 'package:flutter/material.dart';
import 'package:jimprova/models/workout_model.dart';
import 'package:jimprova/widgets/training/exercise_training_card.dart';
class TrainingScreen extends StatefulWidget {
const TrainingScreen({
super.key,
required this.workout,
});
final Workout workout;
@override
State<TrainingScreen> createState() => _TrainingScreenState();
}
class _TrainingScreenState extends State<TrainingScreen> {
int indexEx = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.background,
title: Text(
widget.workout.title,
style: Theme.of(context).textTheme.titleLarge!.copyWith(
color: Theme.of(context).colorScheme.onBackground,
fontWeight: FontWeight.bold,
),
),
),
body: SafeArea(
child: Stack(
children: [
SingleChildScrollView(
// rest of the code... (there are only rows, columns and a listview.builder)
],
),
),
),
],
),
),
);
}
}
1条答案
按热度按时间lb3vh1jj1#
这通常与
surfaceTintColor
属性有关,如果需要,您可以将其设置为透明: