First designs for ui
This commit is contained in:
@@ -1,65 +1,54 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fotodocumentation/pages/ui_utils/general_style.dart';
|
||||
import 'package:fotodocumentation/utils/di_container.dart';
|
||||
|
||||
class PageHeaderWidget extends StatelessWidget {
|
||||
final IconData iconData;
|
||||
final String text;
|
||||
final String subText;
|
||||
final Color? iconColor;
|
||||
|
||||
const PageHeaderWidget({super.key, this.iconData = Icons.business, required this.text, this.subText = "", this.iconColor});
|
||||
const PageHeaderWidget({super.key, required this.text, this.subText = ""});
|
||||
|
||||
GeneralStyle get _generalStyle => DiContainer.get();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final color = iconColor ?? Theme.of(context).colorScheme.primary;
|
||||
return Card(
|
||||
elevation: 2,
|
||||
margin: EdgeInsets.zero,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
side: BorderSide(
|
||||
color: Colors.grey[300]!,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withAlpha(51),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(
|
||||
iconData,
|
||||
size: 32,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Text(
|
||||
text,
|
||||
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (subText.isNotEmpty) ...[
|
||||
const SizedBox(height: 16),
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top:24.0, bottom: 24.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
subText,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
key: Key("PageHeaderTextHeadline"),
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 50,
|
||||
fontFamily: _generalStyle.fontFamily,
|
||||
color: _generalStyle.primaryTextLabelColor,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Image.asset(
|
||||
'assets/images/logo.png',
|
||||
height: 48,
|
||||
),
|
||||
],
|
||||
),
|
||||
if (subText.isNotEmpty) ...[
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
key: Key("PageHeaderTextSubHeadline"),
|
||||
subText,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontFamily: _generalStyle.fontFamily,
|
||||
color: _generalStyle.secondaryTextLabelColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fotodocumentation/l10n/app_localizations.dart';
|
||||
|
||||
class SearchBarCardWidget extends StatefulWidget {
|
||||
final TextEditingController searchController;
|
||||
final Function(String) onSearch;
|
||||
const SearchBarCardWidget({super.key, required this.searchController, required this.onSearch});
|
||||
|
||||
@override
|
||||
State<SearchBarCardWidget> createState() => _SearchBarCardWidgetState();
|
||||
}
|
||||
|
||||
class _SearchBarCardWidgetState extends State<SearchBarCardWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
elevation: 2,
|
||||
margin: EdgeInsets.zero,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
side: BorderSide(
|
||||
color: Colors.grey[300]!,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
key: Key("Search_text_field"),
|
||||
controller: widget.searchController,
|
||||
textAlignVertical: TextAlignVertical.center,
|
||||
decoration: InputDecoration(
|
||||
hintText: AppLocalizations.of(context)!.searchTFHint,
|
||||
border: InputBorder.none,
|
||||
prefixIcon: const Icon(Icons.search, size: 28),
|
||||
contentPadding: EdgeInsets.zero,
|
||||
isDense: true,
|
||||
suffixIcon: InkWell(
|
||||
key: Key("Search_text_clear_button"),
|
||||
onTap: () => _actionClear(),
|
||||
child: const Icon(
|
||||
Icons.close,
|
||||
color: Colors.black,
|
||||
),
|
||||
)
|
||||
),
|
||||
onSubmitted: (_) => _actionSubmit(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
ElevatedButton.icon(
|
||||
key: Key("Search_text_button"),
|
||||
onPressed: _actionSubmit,
|
||||
icon: const Icon(Icons.search, size: 18),
|
||||
label: Text(AppLocalizations.of(context)!.searchButtonLabel),
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _actionSubmit() {
|
||||
widget.onSearch(widget.searchController.text);
|
||||
}
|
||||
|
||||
void _actionClear() {
|
||||
widget.searchController.text = "";
|
||||
widget.onSearch(widget.searchController.text);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fotodocumentation/l10n/app_localizations.dart';
|
||||
import 'package:fotodocumentation/pages/ui_utils/general_style.dart';
|
||||
import 'package:fotodocumentation/utils/di_container.dart';
|
||||
|
||||
class SearchBarWidget extends StatefulWidget {
|
||||
final TextEditingController searchController;
|
||||
final Function(String) onSearch;
|
||||
const SearchBarWidget({super.key, required this.searchController, required this.onSearch});
|
||||
|
||||
@override
|
||||
State<SearchBarWidget> createState() => _SearchBarWidgetState();
|
||||
}
|
||||
|
||||
class _SearchBarWidgetState extends State<SearchBarWidget> {
|
||||
GeneralStyle get _generalStyle => DiContainer.get();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 0.0, vertical: 16.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
key: Key("Search_text_field"),
|
||||
controller: widget.searchController,
|
||||
textAlignVertical: TextAlignVertical.center,
|
||||
decoration: InputDecoration(
|
||||
hint: Text(
|
||||
AppLocalizations.of(context)!.searchTFHint,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontFamily: _generalStyle.fontFamily,
|
||||
color: _generalStyle.secondaryTextLabelColor.withValues(alpha: 0.5),
|
||||
),
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
borderSide: BorderSide(color: _generalStyle.secondaryTextLabelColor),
|
||||
),
|
||||
prefixIcon: Icon(Icons.search, size: 30, color: _generalStyle.secondaryWidgetBackgroundColor,),
|
||||
contentPadding: EdgeInsets.zero,
|
||||
isDense: true,
|
||||
),
|
||||
onSubmitted: (_) => _actionSubmit(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _actionSubmit() {
|
||||
widget.onSearch(widget.searchController.text);
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fotodocumentation/l10n/app_localizations.dart';
|
||||
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class TextInputWidget extends StatelessWidget {
|
||||
final String labelText;
|
||||
final bool required;
|
||||
final bool obscureText;
|
||||
final bool readOnly;
|
||||
final Function? onTap;
|
||||
const TextInputWidget({super.key, required this.labelText, this.required = false, this.obscureText = false, this.readOnly = false, this.onTap});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer<TextEditingController>(builder: (context, controller, child) {
|
||||
return TextFormField(
|
||||
readOnly: readOnly,
|
||||
obscureText: obscureText,
|
||||
controller: controller,
|
||||
decoration: InputDecoration(
|
||||
border: const UnderlineInputBorder(),
|
||||
labelText: labelText,
|
||||
),
|
||||
validator: (String? value) => required && (value == null || value.isEmpty) ? AppLocalizations.of(context)!.textInputWidgetValidatorText : null,
|
||||
onTap: () => onTap?.call(),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class TextMultiInputWidget extends StatelessWidget {
|
||||
final String labelText;
|
||||
final bool required;
|
||||
final bool obscureText;
|
||||
final bool readOnly;
|
||||
final Function? onTap;
|
||||
final int maxLines;
|
||||
const TextMultiInputWidget({super.key, required this.labelText, this.required = false, this.obscureText = false, this.readOnly = false, this.maxLines = 6, this.onTap});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer<TextEditingController>(builder: (context, controller, child) {
|
||||
return TextFormField(
|
||||
readOnly: readOnly,
|
||||
minLines: 3, // Set this
|
||||
maxLines: maxLines, // and this
|
||||
keyboardType: TextInputType.multiline,
|
||||
obscureText: obscureText,
|
||||
controller: controller,
|
||||
decoration: InputDecoration(
|
||||
border: const UnderlineInputBorder(),
|
||||
labelText: labelText,
|
||||
),
|
||||
validator: (String? value) => required && (value == null || value.isEmpty) ? AppLocalizations.of(context)!.textInputWidgetValidatorText : null,
|
||||
onTap: () => onTap?.call(),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
class DialogResult<T> {
|
||||
final DialogResultType type;
|
||||
final T? dto;
|
||||
|
||||
const DialogResult({required this.type, this.dto});
|
||||
}
|
||||
|
||||
enum DialogResultType {
|
||||
create,
|
||||
add;
|
||||
}
|
||||
@@ -1,36 +1,55 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pinput/pinput.dart';
|
||||
|
||||
abstract interface class GeneralStyle {
|
||||
PinTheme get pinTheme;
|
||||
|
||||
ButtonStyle get elevatedButtonStyle;
|
||||
ButtonStyle get roundedButtonStyle;
|
||||
|
||||
Color get primaryTextLabelColor;
|
||||
Color get secondaryTextLabelColor;
|
||||
|
||||
Color get primaryButtonBackgroundColor;
|
||||
Color get primaryButtonTextColor;
|
||||
|
||||
Color get secondaryWidgetBackgroundColor;
|
||||
|
||||
Color get pageBackgroundColor;
|
||||
|
||||
Color get errorColor;
|
||||
|
||||
String get fontFamily;
|
||||
}
|
||||
|
||||
class GeneralStyleImpl implements GeneralStyle {
|
||||
static final ButtonStyle _elevatedButtonStyle = ElevatedButton.styleFrom(textStyle: const TextStyle(fontSize: 20));
|
||||
static final ButtonStyle _roundedButtonStyle = ElevatedButton.styleFrom(shape: const CircleBorder(), padding: const EdgeInsets.all(8));
|
||||
|
||||
@override
|
||||
PinTheme get pinTheme => _getPinTheme();
|
||||
|
||||
@override
|
||||
ButtonStyle get elevatedButtonStyle => _elevatedButtonStyle;
|
||||
|
||||
@override
|
||||
ButtonStyle get roundedButtonStyle => _roundedButtonStyle;
|
||||
|
||||
PinTheme _getPinTheme() {
|
||||
return PinTheme(
|
||||
width: 56,
|
||||
height: 56,
|
||||
textStyle: TextStyle(fontSize: 20, fontWeight: FontWeight.w600),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
);
|
||||
}
|
||||
@override
|
||||
Color get primaryTextLabelColor => const Color(0xFF0045FF);
|
||||
|
||||
@override
|
||||
Color get secondaryTextLabelColor => const Color(0xFF2F2F2F);
|
||||
|
||||
@override
|
||||
Color get primaryButtonBackgroundColor => const Color(0xFF0045FF);
|
||||
|
||||
@override
|
||||
Color get secondaryWidgetBackgroundColor => const Color(0xFF001689);
|
||||
|
||||
@override
|
||||
Color get primaryButtonTextColor => Colors.white;
|
||||
|
||||
@override
|
||||
Color get pageBackgroundColor => const Color(0xFFF5F5F5);
|
||||
|
||||
@override
|
||||
Color get errorColor => const Color(0xFFFF0000);
|
||||
|
||||
@override
|
||||
String get fontFamily => 'Panton';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user