Skip to content

Commit c186585

Browse files
committed
add pre commit script
1 parent 57cd5d8 commit c186585

File tree

8 files changed

+39
-10
lines changed

8 files changed

+39
-10
lines changed

example/lib/main.dart

+4-2
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,10 @@ class _CreateWalletPageState extends State<CreateWalletPage> {
125125
const SizedBox(height: 32.0),
126126
MyButton(
127127
text: 'Pick Media',
128-
onTap: () => Navigator.push(context,
129-
MaterialPageRoute(builder: (builder) => const PickMediaView())))
128+
onTap: () => Navigator.push(
129+
context,
130+
MaterialPageRoute(
131+
builder: (builder) => const PickMediaView())))
130132
],
131133
),
132134
),

example/lib/pick_media_view.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ class _PickMediaViewState extends State<PickMediaView> {
1111
@override
1212
Widget build(BuildContext context) {
1313
return Scaffold(
14-
appBar: AppBar(title: const Text('Pick Media'),),
14+
appBar: AppBar(
15+
title: const Text('Pick Media'),
16+
),
1517
body: Column(
16-
children: const [
17-
18-
],
18+
children: const [],
1919
),
2020
);
2121
}

lib/src/peppermint_constants.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ class PeppermintConstants {
99
'jpg',
1010
'jpeg',
1111
];
12-
}
12+
}

lib/src/widgets/image_loader.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ class VImageLoader extends StatelessWidget {
4040
width: width,
4141
height: height,
4242
fit: boxFit,
43-
placeholder: (context, url) =>
44-
loading ?? const PeppermintLoading(),
43+
placeholder: (context, url) => loading ?? const PeppermintLoading(),
4544
errorWidget: (context, url, error) => SizedBox(
4645
width: width,
4746
height: height,

lib/src/widgets/media/media_controller.dart

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import 'package:get/get.dart';
32

43
class MediaController extends GetxController {

pre-commit.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
echo "Reformatting Flutter code..."
3+
4+
# Reformat Flutter code using the flutter format command
5+
flutter format . &
6+
7+
# Wait for the flutter format command to complete
8+
wait $!
9+
10+
echo "Checking for changes to commit..."
11+
12+
# Check if there are any changes to commit
13+
if git diff-index --quiet HEAD --; then
14+
echo "No changes to commit. Skipping commit."
15+
else
16+
echo "Changes detected. Adding modified files to staging area..."
17+
git add .
18+
fi

pre-push.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
printf "\e[33;1m%s\e[0m\n" 'Running the Flutter analyzer'
3+
flutter analyze
4+
if [ $? -ne 0 ]; then
5+
printf "\e[31;1m%s\e[0m\n" 'Flutter analyzer error'
6+
exit 1
7+
fi
8+
printf "\e[33;1m%s\e[0m\n" 'Finished running the Flutter analyzer'

setup.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
echo "Setting up git-hooks"
2+
cat $(pwd)/pre-push.sh > $(pwd)/.git/hooks/pre-push
3+
cat $(pwd)/pre-commit.sh > $(pwd)/.git/hooks/pre-commit

0 commit comments

Comments
 (0)