Skip to content

Commit 2f9c784

Browse files
added custom accents color
1 parent 5684487 commit 2f9c784

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

lib/widgets/accents_color.dart

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:provider/provider.dart';
3+
import 'package:text_to_image_gen/utils/my_states.dart';
4+
5+
class AccentColors extends StatelessWidget {
6+
const AccentColors({Key? key}) : super(key: key);
7+
8+
@override
9+
Widget build(BuildContext context) {
10+
final accentState = Provider.of<ThemeState>(context);
11+
return Dialog(
12+
child: ListView.builder(
13+
itemCount: 6,
14+
shrinkWrap: true,
15+
itemBuilder: (context, index) {
16+
return ListTileTheme(
17+
selectedColor: Theme.of(context).colorScheme.secondary,
18+
child: ListTile(
19+
leading: CircleAvatar(
20+
backgroundColor: accentState.accentColors[index],
21+
),
22+
title: accentState.accentTexts[index],
23+
selected: index == accentState.currentAccentIndex,
24+
onTap: () {
25+
accentState.changeAccent(index);
26+
Navigator.pop(context);
27+
},
28+
),
29+
);
30+
},
31+
),
32+
);
33+
}
34+
}

0 commit comments

Comments
 (0)