Skip to content

Commit

Permalink
mvoed color picker file
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Wolf committed Aug 12, 2024
1 parent 72b58f2 commit e6e88e8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
28 changes: 28 additions & 0 deletions example/lib/presentation/color_picker_dialog.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class ColorPickerDialog {
static Future<Color?> selectColorDialog(List<Color> colors, BuildContext context) async {
return await showDialog<Color>(
context: context,
builder: (BuildContext context) {
return SimpleDialog(
title: const Text('Select color'),
children: [
...colors.map((color) =>
SimpleDialogOption(
onPressed: () { Navigator.pop(context, color); },
child: Container(
width: 48,
height: 48,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: color),
),
)
)]
);
}
);
}
}
2 changes: 1 addition & 1 deletion example/lib/presentation/pages/calendars.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'dart:io';

import 'package:device_calendar/device_calendar.dart';
import 'package:device_calendar_example/presentation/pages/calendar_add.dart';
import 'package:device_calendar_example/presentation/pages/color_picker_dialog.dart';
import 'package:device_calendar_example/presentation/color_picker_dialog.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:collection/collection.dart';
Expand Down

0 comments on commit e6e88e8

Please sign in to comment.