|
| 1 | +import 'package:master_app/utils/animated_toggle.dart'; |
| 2 | +import 'package:master_app/utils/background_card.dart'; |
| 3 | +import 'package:flutter/material.dart'; |
| 4 | +import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart'; |
| 5 | +import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart' as cc; |
| 6 | + |
| 7 | +class ThemeContainer extends StatelessWidget { |
| 8 | + const ThemeContainer({Key? key}) : super(key: key); |
| 9 | + |
| 10 | + @override |
| 11 | + Widget build(BuildContext context) { |
| 12 | + return const BackGroundCard( |
| 13 | + title: "Theme", |
| 14 | + description: |
| 15 | + "CometChatTheme is a style applied to every component and every view in the activity or component in the UI kit", |
| 16 | + child: ThemeView()); |
| 17 | + } |
| 18 | +} |
| 19 | + |
| 20 | +class ThemeView extends StatefulWidget { |
| 21 | + const ThemeView({Key? key}) : super(key: key); |
| 22 | + |
| 23 | + @override |
| 24 | + _ThemeViewState createState() => _ThemeViewState(); |
| 25 | +} |
| 26 | + |
| 27 | +class _ThemeViewState extends State<ThemeView> { |
| 28 | + final CometChatTheme _customTheme = CometChatTheme( |
| 29 | + palette: const Palette( |
| 30 | + backGroundColor: PaletteModel(dark: Colors.black, light: Colors.black), |
| 31 | + primary: PaletteModel(dark: Colors.green, light: Colors.green), |
| 32 | + secondary: PaletteModel(dark: Colors.grey, light: Colors.black), |
| 33 | + accent: PaletteModel(dark: Colors.green, light: Colors.green), |
| 34 | + success: PaletteModel(dark: Colors.green, light: Colors.green), |
| 35 | + error: PaletteModel(dark: Colors.red, light: Colors.red), |
| 36 | + ), |
| 37 | + typography: cc.Typography.fromDefault()); |
| 38 | + |
| 39 | + |
| 40 | + @override |
| 41 | + Widget build(BuildContext context) { |
| 42 | + return SizedBox( |
| 43 | + child: Column( |
| 44 | + children: [ |
| 45 | + Row( |
| 46 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| 47 | + children: [ |
| 48 | + const Text("Theme"), |
| 49 | + AnimatedToggle( |
| 50 | + values: const ["Default", "Custom"], |
| 51 | + onToggleCallback: (value) {}, |
| 52 | + width: 250) |
| 53 | + ], |
| 54 | + ), |
| 55 | + MaterialButton( |
| 56 | + color: Colors.blue, |
| 57 | + onPressed: () { |
| 58 | + Navigator.push( |
| 59 | + context, |
| 60 | + MaterialPageRoute( |
| 61 | + builder: (context) => CometChatConversations(), |
| 62 | + ), |
| 63 | + ); |
| 64 | + }, |
| 65 | + child: const Text( |
| 66 | + "Launch", |
| 67 | + style: TextStyle(color: Colors.white), |
| 68 | + ), |
| 69 | + ) |
| 70 | + ], |
| 71 | + ), |
| 72 | + ); |
| 73 | + } |
| 74 | +} |
0 commit comments