Initial commit — DLS lab-app Flutter project

This commit is contained in:
egecankomur
2026-06-10 23:22:15 +03:00
commit d1acc1d367
225 changed files with 31294 additions and 0 deletions
+72
View File
@@ -0,0 +1,72 @@
import 'package:flutter/material.dart';
import '../theme/app_theme.dart';
class AppSearchField extends StatelessWidget {
const AppSearchField({
super.key,
required this.controller,
required this.onChanged,
this.hint,
});
final TextEditingController controller;
final ValueChanged<String> onChanged;
final String? hint;
@override
Widget build(BuildContext context) {
return Container(
color: AppColors.surface,
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
child: ListenableBuilder(
listenable: controller,
builder: (context, _) => Container(
decoration: BoxDecoration(
color: AppColors.surfaceVariant,
borderRadius: BorderRadius.circular(12),
border: Border.all(color: AppColors.border),
),
child: TextField(
controller: controller,
onChanged: onChanged,
style: const TextStyle(
fontSize: 14,
color: AppColors.textPrimary,
),
decoration: InputDecoration(
hintText: hint ?? 'Ara...',
hintStyle: const TextStyle(
color: AppColors.textMuted,
fontSize: 14,
),
prefixIcon: const Icon(
Icons.search_rounded,
color: AppColors.textMuted,
size: 20,
),
suffixIcon: controller.text.isNotEmpty
? GestureDetector(
onTap: () {
controller.clear();
onChanged('');
},
child: const Padding(
padding: EdgeInsets.all(12),
child: Icon(
Icons.close_rounded,
color: AppColors.textMuted,
size: 16,
),
),
)
: null,
border: InputBorder.none,
contentPadding: const EdgeInsets.symmetric(vertical: 12),
),
),
),
),
);
}
}
+328
View File
@@ -0,0 +1,328 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../theme/app_theme.dart';
import 'tooth_logo.dart';
class GradientAppBar extends StatelessWidget implements PreferredSizeWidget {
const GradientAppBar({
super.key,
required this.title,
required this.category,
this.actions = const [],
this.searchController,
this.onSearchChanged,
this.searchHint,
});
final String title;
final String category;
final List<Widget> actions;
final TextEditingController? searchController;
final ValueChanged<String>? onSearchChanged;
final String? searchHint;
bool get _hasSearch =>
searchController != null && onSearchChanged != null;
@override
Size get preferredSize =>
Size.fromHeight(kToolbarHeight + (_hasSearch ? 52.0 : 0.0));
@override
Widget build(BuildContext context) {
final isDesktop =
MediaQuery.sizeOf(context).width > AppLayout.sidebarBreakpoint;
final searchBottom = _hasSearch
? _SearchBarBottom(
controller: searchController!,
onChanged: onSearchChanged!,
hint: searchHint ?? 'Ara...',
)
: null;
if (isDesktop) {
return AppBar(
backgroundColor: AppColors.surface,
foregroundColor: AppColors.textPrimary,
elevation: 0,
scrolledUnderElevation: 0,
automaticallyImplyLeading: false,
titleSpacing: 24,
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
'DLS',
style: TextStyle(
fontSize: 11,
color: AppColors.textSecondary.withValues(alpha: 0.8),
letterSpacing: 0.3,
),
),
Text(
title,
style: const TextStyle(
fontSize: 17,
fontWeight: FontWeight.w700,
color: AppColors.textPrimary,
),
),
],
),
actions: [
...actions,
if (actions.isNotEmpty) const SizedBox(width: 8),
],
iconTheme:
const IconThemeData(color: AppColors.textSecondary, size: 22),
actionsIconTheme:
const IconThemeData(color: AppColors.textSecondary, size: 22),
bottom: searchBottom,
);
}
return AppBar(
backgroundColor: AppColors.primary,
foregroundColor: Colors.white,
elevation: 0,
systemOverlayStyle: SystemUiOverlayStyle.light,
automaticallyImplyLeading: false,
leadingWidth: 60,
leading: Padding(
padding: const EdgeInsets.only(left: 16, top: 8, bottom: 8),
child: Container(
decoration: BoxDecoration(
color: Colors.white.withValues(alpha: 0.15),
borderRadius: BorderRadius.circular(10),
),
child:
const Center(child: ToothLogo(size: 20, color: Colors.white)),
),
),
titleSpacing: 8,
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
category,
style: TextStyle(
color: Colors.white.withValues(alpha: 0.65),
fontSize: 11,
fontWeight: FontWeight.w600,
letterSpacing: 1.5,
),
),
Text(
title,
style: const TextStyle(
color: Colors.white,
fontSize: 15,
fontWeight: FontWeight.w700,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
actions: actions.isNotEmpty
? [...actions, const SizedBox(width: 4)]
: null,
iconTheme: const IconThemeData(color: Colors.white, size: 22),
actionsIconTheme:
const IconThemeData(color: Colors.white, size: 22),
flexibleSpace: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Color(0xFF0F172A), AppColors.primary],
),
),
),
bottom: searchBottom,
);
}
}
// ── iOS-26-style search bar shown below the AppBar title ─────────────────────
class _SearchBarBottom extends StatelessWidget implements PreferredSizeWidget {
const _SearchBarBottom({
required this.controller,
required this.onChanged,
required this.hint,
});
final TextEditingController controller;
final ValueChanged<String> onChanged;
final String hint;
@override
Size get preferredSize => const Size.fromHeight(52);
@override
Widget build(BuildContext context) {
final isDesktop =
MediaQuery.sizeOf(context).width > AppLayout.sidebarBreakpoint;
final bg = isDesktop
? AppColors.surfaceVariant
: Colors.white.withValues(alpha: 0.15);
final textColor = isDesktop ? AppColors.textPrimary : Colors.white;
final iconColor = isDesktop
? AppColors.textMuted
: Colors.white.withValues(alpha: 0.65);
final hintColor = isDesktop
? AppColors.textMuted
: Colors.white.withValues(alpha: 0.5);
return SizedBox(
height: 52,
child: Padding(
padding: const EdgeInsets.fromLTRB(16, 4, 16, 10),
child: ListenableBuilder(
listenable: controller,
builder: (context, _) => Container(
height: 38,
decoration: BoxDecoration(
color: bg,
borderRadius: BorderRadius.circular(12),
border: isDesktop
? Border.all(color: AppColors.border)
: null,
),
child: TextField(
controller: controller,
onChanged: onChanged,
style: TextStyle(color: textColor, fontSize: 15),
decoration: InputDecoration(
hintText: hint,
hintStyle: TextStyle(color: hintColor, fontSize: 15),
prefixIcon: Padding(
padding: const EdgeInsets.only(left: 10, right: 6),
child: Icon(Icons.search_rounded,
size: 18, color: iconColor),
),
prefixIconConstraints:
const BoxConstraints(minWidth: 36, minHeight: 36),
suffixIcon: controller.text.isNotEmpty
? GestureDetector(
onTap: () {
controller.clear();
onChanged('');
},
child: Padding(
padding: const EdgeInsets.only(right: 10),
child: Icon(Icons.close_rounded,
size: 16, color: iconColor),
),
)
: null,
suffixIconConstraints:
const BoxConstraints(minWidth: 32, minHeight: 36),
border: InputBorder.none,
contentPadding: const EdgeInsets.symmetric(vertical: 10),
isDense: true,
),
),
),
),
),
);
}
}
// ── Sort / filter bottom sheet ────────────────────────────────────────────────
Future<int?> showSortSheet(
BuildContext context, {
required String title,
required List<String> options,
required int current,
}) {
return showModalBottomSheet<int>(
context: context,
backgroundColor: Colors.transparent,
builder: (ctx) => _SortSheet(
title: title,
options: options,
current: current,
),
);
}
class _SortSheet extends StatelessWidget {
const _SortSheet({
required this.title,
required this.options,
required this.current,
});
final String title;
final List<String> options;
final int current;
@override
Widget build(BuildContext context) {
return Container(
decoration: const BoxDecoration(
color: AppColors.surface,
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 12),
Container(
width: 40,
height: 4,
decoration: BoxDecoration(
color: AppColors.border,
borderRadius: BorderRadius.circular(2),
),
),
const SizedBox(height: 16),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Align(
alignment: Alignment.centerLeft,
child: Text(
title,
style: const TextStyle(
fontSize: 17,
fontWeight: FontWeight.w700,
color: AppColors.textPrimary,
),
),
),
),
const SizedBox(height: 8),
for (int i = 0; i < options.length; i++)
ListTile(
contentPadding:
const EdgeInsets.symmetric(horizontal: 20),
title: Text(
options[i],
style: TextStyle(
color: i == current
? AppColors.primary
: AppColors.textPrimary,
fontWeight: i == current
? FontWeight.w600
: FontWeight.normal,
),
),
trailing: i == current
? const Icon(Icons.check_rounded,
color: AppColors.primary, size: 20)
: null,
onTap: () => Navigator.pop(context, i),
),
SizedBox(height: MediaQuery.paddingOf(context).bottom + 8),
],
),
);
}
}
+121
View File
@@ -0,0 +1,121 @@
import 'package:flutter/material.dart';
import '../theme/app_theme.dart';
class PillTabs extends StatelessWidget {
const PillTabs({
super.key,
required this.tabs,
required this.selected,
required this.onSelect,
this.counts,
});
final List<String> tabs;
final int selected;
final ValueChanged<int> onSelect;
final List<int?>? counts;
@override
Widget build(BuildContext context) {
return Container(
color: AppColors.surface,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
padding: const EdgeInsets.fromLTRB(16, 10, 16, 10),
child: Row(
children: [
for (int i = 0; i < tabs.length; i++) ...[
if (i > 0) const SizedBox(width: 8),
_PillTab(
label: tabs[i],
count: counts != null && i < counts!.length ? counts![i] : null,
selected: selected == i,
onTap: () => onSelect(i),
),
],
],
),
),
const Divider(height: 1, thickness: 1, color: AppColors.border),
],
),
);
}
}
class _PillTab extends StatelessWidget {
const _PillTab({
required this.label,
required this.selected,
required this.onTap,
this.count,
});
final String label;
final bool selected;
final VoidCallback onTap;
final int? count;
@override
Widget build(BuildContext context) {
return Semantics(
label: label,
button: true,
excludeSemantics: true,
child: GestureDetector(
onTap: onTap,
child: AnimatedContainer(
duration: const Duration(milliseconds: 200),
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),
decoration: BoxDecoration(
color: selected ? AppColors.primary : Colors.transparent,
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: selected ? AppColors.primary : AppColors.border,
width: 1.5,
),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
label,
style: TextStyle(
color: selected ? Colors.white : AppColors.textSecondary,
fontSize: 13,
fontWeight: FontWeight.w600,
),
),
if (count != null) ...[
const SizedBox(width: 6),
AnimatedContainer(
duration: const Duration(milliseconds: 200),
padding:
const EdgeInsets.symmetric(horizontal: 6, vertical: 1),
decoration: BoxDecoration(
color: selected
? Colors.white.withValues(alpha: 0.25)
: AppColors.inProgressBg,
borderRadius: BorderRadius.circular(10),
),
child: Text(
'$count',
style: TextStyle(
color: selected ? Colors.white : AppColors.inProgress,
fontSize: 11,
fontWeight: FontWeight.w700,
),
),
),
],
],
),
),
),
);
}
}
+104
View File
@@ -0,0 +1,104 @@
import 'package:flutter/material.dart';
/// Renders the DLS brand logo — navy tooth + cyan chevrons.
///
/// [color] null → brand colors (#00397C tooth + #57B8CE chevrons).
/// Pass a color (e.g. Colors.white) for monochrome override on dark backgrounds.
class ToothLogo extends StatelessWidget {
const ToothLogo({
super.key,
required this.size,
this.color,
});
final double size;
final Color? color;
@override
Widget build(BuildContext context) {
return SizedBox(
width: size * 1.9,
height: size,
child: CustomPaint(
painter: _DlsLogoPainter(color: color),
),
);
}
}
class _DlsLogoPainter extends CustomPainter {
const _DlsLogoPainter({this.color});
final Color? color;
static const _navy = Color(0xFF00397C);
static const _cyan = Color(0xFF57B8CE);
@override
void paint(Canvas canvas, Size size) {
final toothColor = color ?? _navy;
final chevronColor = color ?? _cyan;
// Content bounding box in SVG 200×200 space: x=[42.5..157.5], y=[72..133]
// Width=115, Height=61 → aspect ~1.885 ≈ widget aspect 1.9
const svgLeft = 42.5, svgTop = 72.0, svgWidth = 115.0, svgHeight = 61.0;
final s = size.height / svgHeight;
final dx = (size.width - svgWidth * s) / 2.0 - svgLeft * s;
final dy = (size.height - svgHeight * s) / 2.0 - svgTop * s;
canvas.translate(dx, dy);
canvas.scale(s);
_drawTooth(canvas, toothColor);
_drawChevrons(canvas, chevronColor);
}
static void _drawTooth(Canvas canvas, Color color) {
// SVG path with scale(0.58) + translate(100,100) applied inline.
const cx = 100.0, cy = 100.0, sc = 0.58;
double px(double v) => cx + v * sc;
double py(double v) => cy + v * sc;
final path = Path()
..moveTo(px(0), py(-46))
..cubicTo(px(-22), py(-50), px(-44), py(-38), px(-44), py(-12))
..cubicTo(px(-44), py(8), px(-34), py(32), px(-26), py(46))
..cubicTo(px(-20), py(57), px(-11), py(53), px(-8), py(33))
..cubicTo(px(-6), py(19), px(-2), py(17), px(0), py(17))
..cubicTo(px(2), py(17), px(6), py(19), px(8), py(33))
..cubicTo(px(11), py(53), px(20), py(57), px(26), py(46))
..cubicTo(px(34), py(32), px(44), py(8), px(44), py(-12))
..cubicTo(px(44), py(-38), px(22), py(-50), px(0), py(-46))
..close();
canvas.drawPath(path, Paint()..color = color..style = PaintingStyle.fill);
}
static void _drawChevrons(Canvas canvas, Color color) {
final paint = Paint()
..color = color
..style = PaintingStyle.stroke
..strokeWidth = 11.0
..strokeCap = StrokeCap.round
..strokeJoin = StrokeJoin.round;
// Polyline points + translate(100,100). Left: (-52,-22)→(-34,0)→(-52,22)
canvas.drawPath(
Path()
..moveTo(48, 78)
..lineTo(66, 100)
..lineTo(48, 122),
paint,
);
// Right: (52,-22)→(34,0)→(52,22)
canvas.drawPath(
Path()
..moveTo(152, 78)
..lineTo(134, 100)
..lineTo(152, 122),
paint,
);
}
@override
bool shouldRepaint(_DlsLogoPainter old) => old.color != color;
}