Skip to content

Commit

Permalink
ui: Update ListTile theme
Browse files Browse the repository at this point in the history
  • Loading branch information
0niel committed Jan 3, 2024
1 parent 925222b commit d8420b0
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 75 deletions.
121 changes: 58 additions & 63 deletions lib/presentation/pages/profile/profile_settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,71 +17,66 @@ class ProfileSettingsPage extends StatelessWidget {
),
body: SafeArea(
bottom: false,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: ListView(
children: [
const SizedBox(height: 24),
ListTile(
title: Text("Тема", style: AppTextStyle.body),
leading: Icon(FontAwesomeIcons.palette,
color: AppTheme.colors.active),
trailing: const Icon(Icons.chevron_right),
onTap: () {
showDialog(
context: context,
builder: (context) => SimpleDialog(
title: Text("Выбор темы", style: AppTextStyle.titleS),
contentPadding: const EdgeInsets.all(16),
backgroundColor: AppTheme.colors.background02,
elevation: 0,
children: [
_ListTileThemeItem(
title: "Светлая",
trailing: AppTheme.defaultThemeType ==
AppThemeType.light
? Icon(Icons.check, color: AppTheme.colors.active)
: null,
onTap: () {
context
.read<AppNotifier>()
.updateTheme(AppThemeType.light);
child: ListView(
children: [
const SizedBox(height: 24),
ListTile(
title: Text("Тема", style: AppTextStyle.body),
leading:
Icon(FontAwesomeIcons.palette, color: AppTheme.colors.active),
trailing: const Icon(Icons.chevron_right),
onTap: () {
showDialog(
context: context,
builder: (context) => SimpleDialog(
title: Text("Выбор темы", style: AppTextStyle.titleS),
contentPadding: const EdgeInsets.all(16),
backgroundColor: AppTheme.colors.background02,
elevation: 0,
children: [
_ListTileThemeItem(
title: "Светлая",
trailing: AppTheme.defaultThemeType ==
AppThemeType.light
? Icon(Icons.check, color: AppTheme.colors.active)
: null,
onTap: () {
context
.read<AppNotifier>()
.updateTheme(AppThemeType.light);

context.pop();
},
),
const SizedBox(height: 8),
_ListTileThemeItem(
title: "Тёмная",
trailing: AppTheme.defaultThemeType ==
AppThemeType.dark
? Icon(Icons.check, color: AppTheme.colors.active)
: null,
onTap: () {
context
.read<AppNotifier>()
.updateTheme(AppThemeType.dark);
context.pop();
},
),
const SizedBox(height: 8),
_ListTileThemeItem(
title: "Тёмная",
trailing: AppTheme.defaultThemeType == AppThemeType.dark
? Icon(Icons.check, color: AppTheme.colors.active)
: null,
onTap: () {
context
.read<AppNotifier>()
.updateTheme(AppThemeType.dark);

context.pop();
},
),
],
),
);
},
),
const Divider(),
ListTile(
title: Text("Уведомления", style: AppTextStyle.body),
leading:
Icon(Icons.notifications, color: AppTheme.colors.active),
onTap: () {
context.go("/profile/settings/notifications");
},
),
const Divider(),
],
),
context.pop();
},
),
],
),
);
},
),
const Divider(),
ListTile(
title: Text("Уведомления", style: AppTextStyle.body),
leading: Icon(Icons.notifications, color: AppTheme.colors.active),
onTap: () {
context.go("/profile/settings/notifications");
},
),
const Divider(),
],
),
),
);
Expand Down
4 changes: 2 additions & 2 deletions lib/presentation/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class AppTheme {
),
listTileTheme: ListTileThemeData(
tileColor: darkThemeColors.background01,
contentPadding: EdgeInsets.zero,
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
leadingAndTrailingTextStyle: AppTextStyle.chip.copyWith(
color: AppTheme.colors.active,
),
Expand Down Expand Up @@ -151,7 +151,7 @@ class AppTheme {
),
listTileTheme: ListTileThemeData(
tileColor: lightThemeColors.background01,
contentPadding: EdgeInsets.zero,
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
leadingAndTrailingTextStyle: AppTextStyle.chip.copyWith(
color: AppTheme.colors.active,
),
Expand Down
21 changes: 12 additions & 9 deletions lib/schedule/view/schedule_details_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,10 @@ class _ScheduleDetailsPageState extends State<ScheduleDetailsPage> {
'Предмет',
),
),
body: Padding(
padding: const EdgeInsets.all(24),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: _buildPageContent(),
),
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: _buildPageContent(),
),
),
);
Expand Down Expand Up @@ -199,7 +196,14 @@ class _ScheduleDetailsPageState extends State<ScheduleDetailsPage> {
// Build the teachers
ListTile _buildTeachers() {
return ListTile(
title: Text('Преподаватели'.toUpperCase()),
title: Padding(
padding: EdgeInsets.symmetric(
horizontal:
Theme.of(context).listTileTheme.contentPadding!.horizontal / 2,
),
child: Text('Преподаватели'.toUpperCase()),
),
contentPadding: EdgeInsets.zero,
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: widget.lesson.teachers.map((teacher) {
Expand All @@ -219,7 +223,6 @@ class _ScheduleDetailsPageState extends State<ScheduleDetailsPage> {
)
: null,
dense: true,
contentPadding: EdgeInsets.zero,
visualDensity: VisualDensity.compact,
trailing: const Icon(
Icons.chevron_right_sharp,
Expand Down
7 changes: 7 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.13"
academic_calendar:
dependency: "direct main"
description:
path: "packages/academic_calendar"
relative: true
source: path
version: "0.1.0+1"
after_layout:
dependency: "direct main"
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ publish_to: 'none'
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.4.1+49
version: 1.4.1+50

environment:
sdk: ">=3.1.1"
Expand Down

0 comments on commit d8420b0

Please sign in to comment.