Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ci #6

Closed
wants to merge 3 commits into from
Closed

Ci #6

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/flutter_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI (Flutter)
on: pull_request

jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.4'

- name: Install Dependencies
run: |
flutter pub get

- name: Format Check
run: |
dart format --set-exit-if-changed .

- name: Lint
run: |
flutter analyze

- name: Test
run: |
flutter test
35 changes: 35 additions & 0 deletions .github/workflows/flutter_format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Auto Format on Push (Flutter)

on: push

jobs:
format:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.4'

- name: Install Dependencies
run: |
flutter pub get

- name: Format
run: |
dart format .

- name: Commit and Push Changes Automaticaly
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "Auto Format by GitHub Actions"
git push
fi

28 changes: 17 additions & 11 deletions lib/pages/page_result.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class PageResultState extends State<PageResult> {
});

controllers.add(controllerMap);
}
}
}

@override
Expand All @@ -55,8 +55,8 @@ class PageResultState extends State<PageResult> {
super.dispose();
}

Future<Calendar?> selectCalendar(
BuildContext context, Map<String?, List<Calendar>> groupedCalendars) async {
Future<Calendar?> selectCalendar(BuildContext context,
Map<String?, List<Calendar>> groupedCalendars) async {
return await showDialog<Calendar>(
context: context,
builder: (BuildContext context) {
Expand All @@ -75,7 +75,8 @@ class PageResultState extends State<PageResult> {
for (var calendar in entry.value)
InkWell(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 16),
padding: const EdgeInsets.symmetric(
vertical: 4, horizontal: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
Expand Down Expand Up @@ -127,8 +128,8 @@ class PageResultState extends State<PageResult> {
if (!context.mounted) return;

final groupedCalendars = calendarsResult.data!
.where((calendar) => calendar.isReadOnly == false)
.groupListsBy((calendar) => calendar.accountName);
.where((calendar) => calendar.isReadOnly == false)
.groupListsBy((calendar) => calendar.accountName);

final Calendar? calendar = await selectCalendar(context, groupedCalendars);

Expand Down Expand Up @@ -266,7 +267,8 @@ class EventCardState extends State<EventCard> {

@override
Widget build(BuildContext context) {
String fStart = DateFormat('yyyy/MM/dd HH:mm').format(DateTime.parse(start));
String fStart =
DateFormat('yyyy/MM/dd HH:mm').format(DateTime.parse(start));
String fEnd = DateFormat('yyyy/MM/dd HH:mm').format(DateTime.parse(end));
String fDate;
if (isSameDay(DateTime.parse(start), DateTime.parse(end))) {
Expand Down Expand Up @@ -382,7 +384,9 @@ class EventCardState extends State<EventCard> {
);
}

Widget _buildDateTimeField(BuildContext context, String label, TextEditingController controller, {bool isDateTime = false}) {
Widget _buildDateTimeField(
BuildContext context, String label, TextEditingController controller,
{bool isDateTime = false}) {
return TextField(
controller: controller,
readOnly: true,
Expand Down Expand Up @@ -410,9 +414,11 @@ class EventCardState extends State<EventCard> {
if (!mounted || time == null) return;

// 日時の選択結果をTextFieldに表示
final dateTime = DateTime(date.year, date.month, date.day, time.hour, time.minute);
controller.text = "${dateTime.year}-${dateTime.month}-${dateTime.day}T${time.format(context)}";
final dateTime =
DateTime(date.year, date.month, date.day, time.hour, time.minute);
controller.text =
"${dateTime.year}-${dateTime.month}-${dateTime.day}T${time.format(context)}";
},
);
}
}
}
6 changes: 2 additions & 4 deletions lib/pages/page_top.dart
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ class StatePageTop extends State<PageTop> {
child: ElevatedButton(
onPressed: () => _pickImage(ImageSource.gallery),
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 16)
),
padding: const EdgeInsets.symmetric(vertical: 16)),
child: Text(
'ライブラリから選択する',
style: TextStyle(fontSize: isLandscape(context) ? 24 : 16),
Expand All @@ -156,8 +155,7 @@ class StatePageTop extends State<PageTop> {
child: ElevatedButton(
onPressed: () => _pickImage(ImageSource.camera),
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 16)
),
padding: const EdgeInsets.symmetric(vertical: 16)),
child: Text(
'カメラで写真を撮る',
style: TextStyle(fontSize: isLandscape(context) ? 24 : 16),
Expand Down
2 changes: 1 addition & 1 deletion lib/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MyAppBar extends StatelessWidget implements PreferredSizeWidget {
'assets/icon/logo_name.png',
height: 40,
),
onTap:() {
onTap: () {
Navigator.of(context).pushReplacementNamed('/');
},
);
Expand Down