Skip to content

Commit

Permalink
Merge pull request #31 from mustafauys/master
Browse files Browse the repository at this point in the history
Updated with minor changes.
  • Loading branch information
VB10 committed Sep 24, 2022
2 parents 4ceee35 + 3303648 commit ce59609
Show file tree
Hide file tree
Showing 27 changed files with 396 additions and 117 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,20 @@

</table>

# Color Constants

<table>
<tr>
<td><img src="github/images/constants/sc1.png" width=900 height=250></td>
</tr>
<tr>
<td><img src="github/images/constants/sc3.png" width=900 height=100></td>
</tr>
<tr>
<td><img src="github/images/constants/sc2.png" width=900 height=200></td>
</tr>
</table>


# Divider

Expand Down Expand Up @@ -245,4 +259,4 @@
<td><img src="github\images\stacked_images\stackedimg.png" width=270 height=480></td>
</tr>

</table>
</table>
Binary file added github/images/constants/sc1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added github/images/constants/sc2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added github/images/constants/sc3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 11 additions & 6 deletions lib/atomic/button/asynchronous_button.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import 'package:flutter/material.dart';
import 'package:ready_to_use_widgets/core/init/constants/color_constant.dart';

final buttonStyle = ButtonStyle(
shape: MaterialStateProperty.all(RoundedRectangleBorder(borderRadius: BorderRadius.circular(10))),
backgroundColor: MaterialStateProperty.all(const Color.fromARGB(255, 229, 78, 118)),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(borderRadius: BorderRadius.circular(10))),
backgroundColor:
MaterialStateProperty.all(const Color.fromARGB(255, 229, 78, 118)),
minimumSize: MaterialStateProperty.all(const Size(200, 50)),
);

Expand All @@ -23,7 +26,6 @@ class AsynchronousButton extends StatefulWidget {
}

class _AsynchronousButtonState extends State<AsynchronousButton> {

bool _isButtonBusy = false;
void _updateButtonState() => setState(() => _isButtonBusy = !_isButtonBusy);

Expand All @@ -38,7 +40,10 @@ class _AsynchronousButtonState extends State<AsynchronousButton> {
await widget.onPressed();
_updateButtonState();
},
child: Center(child: _isButtonBusy ? const _BusyWidget() : _ButtonText(buttonText: widget.buttonText)),
child: Center(
child: _isButtonBusy
? const _BusyWidget()
: _ButtonText(buttonText: widget.buttonText)),
style: buttonStyle,
),
);
Expand All @@ -52,7 +57,7 @@ class _BusyWidget extends StatelessWidget {

@override
Widget build(BuildContext context) {
return const CircularProgressIndicator(color: Colors.white);
return const CircularProgressIndicator(color: ColorConstants.white);
}
}

Expand All @@ -68,7 +73,7 @@ class _ButtonText extends StatelessWidget {
Widget build(BuildContext context) {
return Text(
buttonText,
style: const TextStyle(color: Colors.white),
style: const TextStyle(color: ColorConstants.white),
textAlign: TextAlign.center,
);
}
Expand Down
12 changes: 10 additions & 2 deletions lib/atomic/button/custom_elevated_button.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:ready_to_use_widgets/core/init/constants/color_constant.dart';

// WIDGET DESCRIPTION
// It is a widget where you can set your button as you want and make new widgets for your own buttons.
Expand All @@ -14,7 +15,13 @@ class CustomElevatedButton extends StatelessWidget {
final VoidCallback? onPressed;

const CustomElevatedButton(
{Key? key, this.color, this.height, this.width, this.borderRadius, this.onPressed, required this.child})
{Key? key,
this.color,
this.height,
this.width,
this.borderRadius,
this.onPressed,
required this.child})
: super(key: key);

@override
Expand All @@ -25,7 +32,8 @@ class CustomElevatedButton extends StatelessWidget {
child: ElevatedButton(
onPressed: onPressed,
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(color ?? Colors.pink),
backgroundColor:
MaterialStateProperty.all(color ?? ColorConstants.amaranth),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(borderRadius ?? 2),
Expand Down
4 changes: 2 additions & 2 deletions lib/atomic/circular_progress/loading_circular_progress.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import 'package:flutter/material.dart';
import 'package:ready_to_use_widgets/core/init/constants/color_constant.dart';

class LoadingCircular extends StatelessWidget {
final dynamic progress;
Expand Down Expand Up @@ -29,7 +29,7 @@ class LoadingCircular extends StatelessWidget {
width: width,
height: height,
child: CircularProgressIndicator(
backgroundColor: Colors.white70,
backgroundColor: ColorConstants.white70,
value: progress,
color: color,
strokeWidth: 3.0,
Expand Down
9 changes: 4 additions & 5 deletions lib/atomic/glow_image/example_glow_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import 'glow_image.dart';

class ExampleGlowImage extends StatefulWidget {
ExampleGlowImage({Key? key}) : super(key: key);
const ExampleGlowImage({Key? key}) : super(key: key);

@override
State<ExampleGlowImage> createState() => _ExampleGlowImageState();
Expand All @@ -14,8 +14,7 @@ class _ExampleGlowImageState extends State<ExampleGlowImage> {

@override
Widget build(BuildContext context) {
final size = MediaQuery.of(context).size;
final _width = 300.0;
const _width = 300.0;
return Scaffold(
body: SafeArea(
child: Column(
Expand All @@ -30,9 +29,9 @@ class _ExampleGlowImageState extends State<ExampleGlowImage> {
child: AnimatedContainer(
curve: Curves.easeInOutBack,
width: tapped ? _width : _width * 0.8,
duration: Duration(milliseconds: 450),
duration: const Duration(milliseconds: 450),
child: GlowImage(
child: Photo()
child: const Photo()
// Container(
// width: _width,
// color: Colors.green,
Expand Down
22 changes: 15 additions & 7 deletions lib/atomic/group_checkbox/example/group_checkbox_example_view.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:ready_to_use_widgets/core/init/constants/color_constant.dart';

import '../model/abstract_checkbox_item.dart';
import '../model/city_model.dart';
Expand All @@ -10,7 +11,8 @@ class GroupCheckboxExampleView extends StatefulWidget {
}) : super(key: key);

@override
State<GroupCheckboxExampleView> createState() => _GroupCheckboxExampleViewState();
State<GroupCheckboxExampleView> createState() =>
_GroupCheckboxExampleViewState();
}

class _GroupCheckboxExampleViewState extends State<GroupCheckboxExampleView> {
Expand All @@ -20,8 +22,10 @@ class _GroupCheckboxExampleViewState extends State<GroupCheckboxExampleView> {
ICheckBoxItem? initialItem;
ICheckBoxItem? lastSelectedItem;

TextStyle contentTextStyle = const TextStyle(fontSize: 24, color: Colors.red);
TextStyle titleTextStyle = const TextStyle(fontSize: 32, color: Colors.black);
TextStyle contentTextStyle =
const TextStyle(fontSize: 24, color: ColorConstants.pomegranate);
TextStyle titleTextStyle =
const TextStyle(fontSize: 32, color: ColorConstants.black);

@override
void initState() {
Expand Down Expand Up @@ -50,8 +54,10 @@ class _GroupCheckboxExampleViewState extends State<GroupCheckboxExampleView> {
});
},
allSelectedItemList: (List<ICheckBoxItem>? allSelectedItems) {
debugPrint('All selected items lenght : ${allSelectedItems?.length}');
debugPrint('All selected items : ${allSelectedItems?.toString()}');
debugPrint(
'All selected items lenght : ${allSelectedItems?.length}');
debugPrint(
'All selected items : ${allSelectedItems?.toString()}');
_allSelectedItemList = allSelectedItems;
setState(() {});
},
Expand All @@ -76,7 +82,9 @@ class _GroupCheckboxExampleViewState extends State<GroupCheckboxExampleView> {
_isMultiSelectEnable = !_isMultiSelectEnable;
});
},
child: Text(_isMultiSelectEnable ? 'Multi Select Enabled' : 'Multi Select Disabled'),
child: Text(_isMultiSelectEnable
? 'Multi Select Enabled'
: 'Multi Select Disabled'),
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
_isMultiSelectEnable ? Colors.green : Colors.red,
Expand Down Expand Up @@ -104,7 +112,7 @@ class _GroupCheckboxExampleViewState extends State<GroupCheckboxExampleView> {
itemCount: _cityList.length,
itemBuilder: (context, index) {
return InkWell(
hoverColor: Colors.black,
hoverColor: ColorConstants.black,
onTap: () {
setState(() {
_allSelectedItemList?.clear();
Expand Down
26 changes: 17 additions & 9 deletions lib/atomic/snackbar/custom_snackbar.dart
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
import 'package:flutter/material.dart';

import 'package:ready_to_use_widgets/core/init/constants/color_constant.dart';

class CustomSnackBar {
static void showSnackBar(BuildContext context,String message,{TextStyle? messageStyle,double? margin,Duration? duration,SnackBarAction? action,Color? color,BorderRadius? radius}) {
static void showSnackBar(BuildContext context, String message,
{TextStyle? messageStyle,
double? margin,
Duration? duration,
SnackBarAction? action,
Color? color,
BorderRadius? radius}) {
var snackbar = SnackBar(
content: Text(message,
style: messageStyle ?? const TextStyle(
color: Colors.white
),
content: Text(
message,
style: messageStyle ??
const TextStyle(
color: ColorConstants.white,
),
),
margin: EdgeInsets.all(margin ?? 10),
duration: duration ??const Duration(seconds: 3),
margin: EdgeInsets.all(margin ?? 10),
duration: duration ?? const Duration(seconds: 3),
action: action,
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius:radius ?? BorderRadius.circular(10),
borderRadius: radius ?? BorderRadius.circular(10),
),
backgroundColor: color ?? Colors.redAccent,
);
Expand Down
15 changes: 15 additions & 0 deletions lib/core/init/constants/color_constant.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'package:flutter/material.dart';

// Çalışma Mantığı
// Kullanacağımız renk kodunu ismiyle birlikte buraya ekliyoruz.
// Daha sonra buradaki rengi kullanacağımız widget içine önce bu file import ediyoruz.
// Import ettikten sonra rengi kullanacağımız satıra gelip 'ColorConstants.white' örneği gibi istediğimiz rengi ekliyoruz. Detaylar Readme.md
class ColorConstants {
static const Color black = Color(0xFF000000);
static const Color white = Color(0xFFffffff);
static const Color white70 = Color(0xB3FFFFFF);
static const Color amaranth = Color(0xFFE91E63);
static const Color pomegranate = Color(0xFFE91E63);
static const Color dodgerBlue = Color(0xFF2196F3);
static const Color fruitSalad = Color(0xFF4CAF50);
}
7 changes: 7 additions & 0 deletions lib/core/init/theme/base/base_theme.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import 'package:flutter/material.dart';

abstract class BaseTheme {
ThemeData get themeData;

TextStyle get customSnackBar;
}
20 changes: 20 additions & 0 deletions lib/core/init/theme/dark_theme.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import 'package:flutter/material.dart';
import 'package:ready_to_use_widgets/core/init/theme/base/base_theme.dart';

class DarkTheme extends BaseTheme {
static DarkTheme? _instance;

static DarkTheme? get instance {
if (_instance != null) return _instance;
_instance = DarkTheme._init();
return _instance;
}

DarkTheme._init();

@override
ThemeData get themeData => throw UnimplementedError();

@override
TextStyle get customSnackBar => throw UnimplementedError();
}
31 changes: 31 additions & 0 deletions lib/core/init/theme/enum/theme_enum.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
enum AppTheme { dark, light }

extension AppThemeExtension on AppTheme {
String get appThemeToString {
switch (this) {
case AppTheme.dark:
return 'AppTheme.DARK';
case AppTheme.light:
return 'AppTheme.LIGHT';
default:
{
return 'AppTheme.LIGHT';
}
}
}
}

extension AppThemeStringExtension on String {
AppTheme get stringToAppTheme {
switch (this) {
case 'AppTheme.DARK':
return AppTheme.dark;
case 'AppTheme.LIGHT':
return AppTheme.light;
default:
{
return AppTheme.light;
}
}
}
}
31 changes: 31 additions & 0 deletions lib/core/init/theme/light_theme.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:ready_to_use_widgets/atomic/beauty_textfield/beauty_textfield.dart';
import 'package:ready_to_use_widgets/core/init/constants/color_constant.dart';
import 'package:ready_to_use_widgets/core/init/theme/base/base_theme.dart';

class LightTheme extends BaseTheme {
static LightTheme? _instance;

static LightTheme? get instance {
if (_instance != null) return _instance;
_instance = LightTheme._init();
return _instance;
}

LightTheme._init();

@override
ThemeData get themeData => throw UnimplementedError();

// Örnek olarak yapılmıştır.

@override
TextStyle get customSnackBar => GoogleFonts.ubuntu(
textStyle: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: ColorConstants.dodgerBlue,
),
);
}

0 comments on commit ce59609

Please sign in to comment.