forked from firka/firka
fix: make corner radius up to par with design
This commit is contained in:
36
firka/lib/ui/components/firka_icon_button.dart
Normal file
36
firka/lib/ui/components/firka_icon_button.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
import "package:flutter/material.dart";
|
||||
|
||||
import "package:firka/ui/theme/style.dart";
|
||||
|
||||
class FirkaIconButton extends StatelessWidget {
|
||||
final Widget child;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
const FirkaIconButton({required this.child, this.onTap, super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final button = Container(
|
||||
width: 32,
|
||||
height: 32,
|
||||
padding: const EdgeInsets.all(6),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: appStyle.colors.buttonSecondaryFill,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: appStyle.colors.shadowColor,
|
||||
offset: const Offset(0, 1),
|
||||
blurRadius: appStyle.colors.shadowBlur.toDouble(),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: child,
|
||||
);
|
||||
|
||||
if (onTap == null) return button;
|
||||
|
||||
return GestureDetector(onTap: onTap, child: button);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,47 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:majesticons_flutter/majesticons_flutter.dart';
|
||||
|
||||
import 'package:firka/app/app_state.dart';
|
||||
import 'package:firka/core/bloc/theme_cubit.dart';
|
||||
import 'package:firka/core/settings.dart';
|
||||
import 'package:firka/core/settings/settings_repository.dart';
|
||||
import 'package:firka/core/settings/settings_schema.dart';
|
||||
import 'package:firka_common/ui/components/firka_shadow.dart';
|
||||
import 'package:firka_common/ui/components/firka_card.dart';
|
||||
import 'package:firka/ui/shared/firka_icon.dart';
|
||||
import 'package:firka/ui/theme/style.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
Widget _extrasActionTile({
|
||||
required double width,
|
||||
required VoidCallback onTap,
|
||||
required Widget icon,
|
||||
required String label,
|
||||
}) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: FirkaCard.single(
|
||||
width: width,
|
||||
height: 60,
|
||||
margin: EdgeInsets.zero,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12.0),
|
||||
child: Row(
|
||||
children: [
|
||||
icon,
|
||||
const SizedBox(width: 4),
|
||||
Flexible(
|
||||
child: Text(
|
||||
label,
|
||||
textAlign: TextAlign.right,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: appStyle.fonts.B_16R.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void showExtrasBottomSheet(BuildContext context, AppInitialization data) {
|
||||
Widget Function(double) debugBtn = (_) => const SizedBox();
|
||||
@@ -18,52 +49,20 @@ void showExtrasBottomSheet(BuildContext context, AppInitialization data) {
|
||||
logger.finest("showExtrasBottomSheet() developer mode: ${isDeveloper()}");
|
||||
|
||||
if (isDeveloper()) {
|
||||
debugBtn = (double itemWidth) => GestureDetector(
|
||||
debugBtn = (double itemWidth) => _extrasActionTile(
|
||||
// Fejlesztői menü
|
||||
width: itemWidth,
|
||||
onTap: () {
|
||||
context.pop();
|
||||
context.push('/debug');
|
||||
},
|
||||
child: SizedBox(
|
||||
height: 60,
|
||||
width: itemWidth,
|
||||
child: FirkaShadow(
|
||||
shadow: true,
|
||||
child: Card(
|
||||
color: appStyle.colors.card,
|
||||
shadowColor: context.watch<ThemeCubit>().state.isLightMode
|
||||
? null
|
||||
: Colors.transparent,
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12.0),
|
||||
child: Row(
|
||||
children: [
|
||||
FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.bug2Solid,
|
||||
size: 22.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
Flexible(
|
||||
child: Text(
|
||||
data.l10n.debug_screen,
|
||||
textAlign: TextAlign.right,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: appStyle.fonts.B_16R.apply(
|
||||
color: appStyle.colors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
icon: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.bug2Solid,
|
||||
size: 22.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
label: data.l10n.debug_screen,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -116,12 +115,13 @@ void showExtrasBottomSheet(BuildContext context, AppInitialization data) {
|
||||
builder: (context, constraints) {
|
||||
final itemWidth = (constraints.maxWidth - 8) / 2;
|
||||
return Wrap(
|
||||
spacing: 2,
|
||||
runSpacing: 2,
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: [
|
||||
debugBtn(itemWidth),
|
||||
GestureDetector(
|
||||
_extrasActionTile(
|
||||
// Fiókod
|
||||
width: itemWidth,
|
||||
onTap: () {
|
||||
context.pop();
|
||||
context.push(
|
||||
@@ -131,113 +131,28 @@ void showExtrasBottomSheet(BuildContext context, AppInitialization data) {
|
||||
).children,
|
||||
);
|
||||
},
|
||||
child: SizedBox(
|
||||
height: 60,
|
||||
width: itemWidth,
|
||||
child: FirkaShadow(
|
||||
shadow: true,
|
||||
child: Card(
|
||||
color: appStyle.colors.card,
|
||||
shadowColor:
|
||||
context
|
||||
.watch<ThemeCubit>()
|
||||
.state
|
||||
.isLightMode
|
||||
? null
|
||||
: Colors.transparent,
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12.0,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.userSolid,
|
||||
size: 22.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
Flexible(
|
||||
child: Text(
|
||||
data.l10n.s_your_account,
|
||||
textAlign: TextAlign.right,
|
||||
overflow:
|
||||
TextOverflow.ellipsis,
|
||||
style: appStyle.fonts.B_16R
|
||||
.apply(
|
||||
color: appStyle
|
||||
.colors
|
||||
.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
icon: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.userSolid,
|
||||
size: 22.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
label: data.l10n.s_your_account,
|
||||
),
|
||||
GestureDetector(
|
||||
_extrasActionTile(
|
||||
// Beállítás
|
||||
width: itemWidth,
|
||||
onTap: () {
|
||||
context.pop();
|
||||
context.push('/settings');
|
||||
},
|
||||
child: SizedBox(
|
||||
height: 60,
|
||||
width: itemWidth,
|
||||
child: FirkaShadow(
|
||||
shadow: true,
|
||||
child: Card(
|
||||
color: appStyle.colors.card,
|
||||
shadowColor:
|
||||
context
|
||||
.watch<ThemeCubit>()
|
||||
.state
|
||||
.isLightMode
|
||||
? null
|
||||
: Colors.transparent,
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12.0,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.settingsCogSolid,
|
||||
size: 22.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
Flexible(
|
||||
child: Text(
|
||||
data.l10n.settings_screen,
|
||||
textAlign: TextAlign.right,
|
||||
overflow:
|
||||
TextOverflow.ellipsis,
|
||||
style: appStyle.fonts.B_16R
|
||||
.apply(
|
||||
color: appStyle
|
||||
.colors
|
||||
.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
icon: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.settingsCogSolid,
|
||||
size: 22.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
label: data.l10n.settings_screen,
|
||||
),
|
||||
// Ide jön a többi gomb majd
|
||||
],
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:firka_common/data/util.dart';
|
||||
import 'package:firka_common/ui/components/filled_circle.dart';
|
||||
import 'package:firka/core/extensions.dart';
|
||||
import 'package:firka/ui/components/common_bottom_sheets.dart';
|
||||
import 'package:firka/ui/components/firka_icon_button.dart';
|
||||
import 'package:firka/ui/phone/widgets/grade_chart.dart';
|
||||
import 'package:firka/ui/shared/class_icon.dart';
|
||||
import 'package:firka/ui/shared/firka_icon.dart';
|
||||
@@ -232,19 +233,7 @@ class _HomeGradesSubjectScreen extends FirkaState<HomeGradesSubjectScreen> {
|
||||
),
|
||||
],
|
||||
),
|
||||
GestureDetector(
|
||||
child: Card(
|
||||
color: appStyle.colors.buttonSecondaryFill,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.menuSolid,
|
||||
size: 26.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
),
|
||||
),
|
||||
FirkaIconButton(
|
||||
onTap: () {
|
||||
showSubjectBottomSheetSettings(
|
||||
context,
|
||||
@@ -255,6 +244,12 @@ class _HomeGradesSubjectScreen extends FirkaState<HomeGradesSubjectScreen> {
|
||||
},
|
||||
);
|
||||
},
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.menuSolid,
|
||||
size: 20.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'package:firka/core/settings.dart';
|
||||
import 'package:firka/core/settings/settings_repository.dart';
|
||||
import 'package:firka/core/settings/settings_schema.dart';
|
||||
import 'package:firka/ui/theme/style.dart';
|
||||
import 'package:firka/ui/components/firka_icon_button.dart';
|
||||
import 'package:firka/ui/phone/screens/settings/settings_screen.dart';
|
||||
import 'package:firka/ui/phone/widgets/bubble_test.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -417,52 +418,31 @@ class _HomeTimetableScreen extends FirkaState<HomeTimetableScreen>
|
||||
),
|
||||
),
|
||||
Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
GestureDetector(
|
||||
child: Card(
|
||||
color: appStyle.colors.buttonSecondaryFill,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.tableSolid,
|
||||
size: 26.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
),
|
||||
),
|
||||
FirkaIconButton(
|
||||
onTap: () {
|
||||
context.push('/timetable/monthly');
|
||||
},
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.tableSolid,
|
||||
size: 20.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
),
|
||||
/* TODO: 1.1.0
|
||||
|
||||
Card(
|
||||
color: appStyle.colors.buttonSecondaryFill,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.plusLine,
|
||||
size: 32.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
FirkaIconButton(
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.plusLine,
|
||||
size: 20.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
),
|
||||
*/
|
||||
GestureDetector(
|
||||
child: Card(
|
||||
color: appStyle.colors.buttonSecondaryFill,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.settingsCogSolid,
|
||||
size: 26.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
),
|
||||
),
|
||||
FirkaIconButton(
|
||||
onTap: () {
|
||||
showSettingsSheet(
|
||||
context,
|
||||
@@ -471,6 +451,12 @@ class _HomeTimetableScreen extends FirkaState<HomeTimetableScreen>
|
||||
timetableToastTree(widget.data.l10n),
|
||||
);
|
||||
},
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.settingsCogSolid,
|
||||
size: 20.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:firka/ui/components/firka_icon_button.dart';
|
||||
import 'package:firka/ui/phone/screens/settings/settings_screen.dart';
|
||||
import 'package:firka_common/data/models/lesson_cache_model.dart';
|
||||
import 'package:firka_common/data/util.dart';
|
||||
@@ -260,50 +261,29 @@ class _HomeTimetableMonthlyScreen
|
||||
),
|
||||
),
|
||||
Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
GestureDetector(
|
||||
child: Card(
|
||||
color: appStyle.colors.buttonSecondaryFill,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.tableSolid,
|
||||
size: 26.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
),
|
||||
),
|
||||
FirkaIconButton(
|
||||
onTap: () {
|
||||
context.pop();
|
||||
},
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.tableSolid,
|
||||
size: 20.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
),
|
||||
// Nincs elkészítve jelenleg: Dolgozat stb hozzáadása(?)
|
||||
// Card(
|
||||
// color: appStyle.colors.buttonSecondaryFill,
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.all(4),
|
||||
// child: FirkaIconWidget(
|
||||
// FirkaIconType.majesticons,
|
||||
// Majesticon.plusLine,
|
||||
// size: 32.0,
|
||||
// color: appStyle.colors.accent,
|
||||
// ),
|
||||
// FirkaIconButton(
|
||||
// child: FirkaIconWidget(
|
||||
// FirkaIconType.majesticons,
|
||||
// Majesticon.plusLine,
|
||||
// size: 20.0,
|
||||
// color: appStyle.colors.accent,
|
||||
// ),
|
||||
// ),
|
||||
GestureDetector(
|
||||
child: Card(
|
||||
color: appStyle.colors.buttonSecondaryFill,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.settingsCogSolid,
|
||||
size: 26.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
),
|
||||
),
|
||||
FirkaIconButton(
|
||||
onTap: () {
|
||||
showSettingsSheet(
|
||||
context,
|
||||
@@ -312,6 +292,12 @@ class _HomeTimetableMonthlyScreen
|
||||
timetableToastTree(widget.data.l10n),
|
||||
);
|
||||
},
|
||||
child: FirkaIconWidget(
|
||||
FirkaIconType.majesticons,
|
||||
Majesticon.settingsCogSolid,
|
||||
size: 20.0,
|
||||
color: appStyle.colors.accent,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user