push basic layouts and shared widgets

This commit is contained in:
ashrafzarkanisala
2024-08-22 00:09:42 +03:00
parent f773c9e52c
commit e576fb3b47
14 changed files with 328 additions and 164 deletions

View File

@ -0,0 +1,71 @@
import 'package:flutter/material.dart';
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
import 'package:syncrow_web/utils/style.dart';
import 'package:syncrow_web/utils/color_manager.dart';
class SearchResetButtons extends StatelessWidget {
const SearchResetButtons({
super.key,
required this.onSearch,
required this.onReset,
});
final VoidCallback onSearch;
final VoidCallback onReset;
@override
Widget build(BuildContext context) {
return Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 25),
Center(
child: Container(
height: 43,
width: 100,
decoration: containerDecoration,
child: Center(
child: DefaultButton(
onPressed: onSearch,
borderRadius: 9,
child: const Text('Search'),
),
),
),
),
],
),
const SizedBox(width: 10),
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 25),
Center(
child: Container(
height: 43,
width: 100,
decoration: containerDecoration,
child: Center(
child: DefaultButton(
backgroundColor: ColorsManager.whiteColors,
borderRadius: 9,
child: Text(
'Reset',
style: Theme.of(context)
.textTheme
.bodySmall!
.copyWith(color: Colors.black),
),
onPressed: onReset,
),
),
),
),
],
),
],
);
}
}

View File

@ -0,0 +1,103 @@
import 'package:flutter/material.dart';
import 'package:syncrow_web/core/extension/build_context_x.dart';
class StatefulTextField extends StatefulWidget {
const StatefulTextField({
super.key,
required this.title,
this.hintText = 'Please enter',
required this.width,
this.elevation = 0,
});
final String title;
final String hintText;
final double width;
final double elevation;
@override
State<StatefulTextField> createState() => _StatefulTextFieldState();
}
class _StatefulTextFieldState extends State<StatefulTextField> {
late TextEditingController _controller;
@override
void initState() {
super.initState();
_controller = TextEditingController();
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return CustomTextField(
title: widget.title,
controller: _controller,
hintText: widget.hintText,
width: widget.width,
elevation: widget.elevation,
);
}
}
class CustomTextField extends StatelessWidget {
const CustomTextField({
super.key,
required this.title,
required this.controller,
this.hintText = 'Please enter',
required this.width,
this.elevation = 0,
});
final String title;
final TextEditingController controller;
final String hintText;
final double width;
final double elevation;
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
title,
style: context.textTheme.bodyMedium!.copyWith(
fontWeight: FontWeight.w600,
color: const Color(0xff000000),
),
),
const SizedBox(height: 8),
Material(
elevation: elevation,
borderRadius: BorderRadius.circular(8),
child: Container(
width: width,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
),
child: TextFormField(
controller: controller,
style: const TextStyle(color: Colors.black),
decoration: InputDecoration(
hintText: hintText,
contentPadding:
const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
border: InputBorder.none,
),
),
),
),
],
);
}
}