Skip to content

Commit

Permalink
TGA-6: Move styles from Whisper app
Browse files Browse the repository at this point in the history
  • Loading branch information
Dapucla authored Sep 17, 2024
1 parent ea905dc commit afc1a27
Show file tree
Hide file tree
Showing 9 changed files with 173 additions and 155 deletions.
22 changes: 13 additions & 9 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import 'ui/theme/light_theme.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();

runApp(MyApp(api: Api()));
runApp(
MyApp(api: Api()),
);
}

class MyApp extends StatelessWidget {
Expand All @@ -30,19 +32,21 @@ class MyApp extends StatelessWidget {
return MultiBlocProvider(
providers: [
BlocProvider<MainCubit>(
create: (context) => MainCubit(), // MainCubit doesn't need the Api
create: (context) => MainCubit(),
lazy: false,
),
],
child: Builder(
builder: (context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
systemNavigationBarColor: context.background,
statusBarColor: context.background,
systemNavigationBarDividerColor: Colors.transparent,
statusBarIconBrightness:
context.isDark ? Brightness.light : Brightness.dark,
));
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(
systemNavigationBarColor: context.background,
statusBarColor: context.background,
systemNavigationBarDividerColor: Colors.transparent,
statusBarIconBrightness:
context.isDark ? Brightness.light : Brightness.dark,
),
);

return MaterialApp(
debugShowCheckedModeBanner: false,
Expand Down
30 changes: 15 additions & 15 deletions lib/ui/chat_menu_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ChatMenuScreen extends StatefulWidget {
}

class _ChatMenuScreenState extends State<ChatMenuScreen> {
List<String> _previousChats = [];
var _previousChats = <String>[];

@override
void initState() {
Expand All @@ -29,7 +29,7 @@ class _ChatMenuScreenState extends State<ChatMenuScreen> {
}

@override
Widget build(BuildContext context) {
Widget build(BuildContext c) {
return Scaffold(
appBar: MyAppBar(
onTap: _startNewChat,
Expand All @@ -39,17 +39,17 @@ class _ChatMenuScreenState extends State<ChatMenuScreen> {
firstIconSize: AppSize.iconSizeSmall,
secondIconSize: AppSize.iconSizeMicro,
),
backgroundColor: context.background,
backgroundColor: c.background,
body: SafeArea(
child: SingleChildScrollView(
child: Column(
children: [
ListView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
physics: const NeverScrollableScrollPhysics(),
itemCount: _previousChats.length,
itemBuilder: (context, index) {
final chatTitle = _previousChats[index];
itemBuilder: (c, i) {
final chatTitle = _previousChats[i];
return ListTile(
leading: SvgPicture.asset(
AppImages.chatIcon,
Expand All @@ -70,12 +70,12 @@ class _ChatMenuScreenState extends State<ChatMenuScreen> {
),
onSelected: (value) {
if (value == 0) {
_editChatName(index);
_editChatName(i);
} else if (value == 1) {
_deleteChat(index);
_deleteChat(i);
}
},
itemBuilder: (context) => [
itemBuilder: (c) => [
const PopupMenuItem(
value: 0,
child: Texts(
Expand All @@ -87,7 +87,7 @@ class _ChatMenuScreenState extends State<ChatMenuScreen> {
value: 1,
child: Texts(
'Delete',
color: context.red,
color: c.red,
fontWeight: FontWeight.w600,
),
),
Expand All @@ -103,7 +103,7 @@ class _ChatMenuScreenState extends State<ChatMenuScreen> {
onTap: () => _openChat(chatTitle),
contentPadding: const EdgeInsets.symmetric(
vertical: 10, horizontal: 15),
tileColor: context.background,
tileColor: c.background,
shape: const Border(
bottom: BorderSide(color: AppColors.gray, width: 1.0),
),
Expand Down Expand Up @@ -175,9 +175,9 @@ class _ChatMenuScreenState extends State<ChatMenuScreen> {
TextEditingController(text: oldTitle);
showDialog(
context: context,
builder: (context) {
builder: (c) {
return AlertDialog(
backgroundColor: context.background,
backgroundColor: c.background,
title: const Texts(
'Edit Chat Name',
fontWeight: FontWeight.w600,
Expand All @@ -190,7 +190,7 @@ class _ChatMenuScreenState extends State<ChatMenuScreen> {
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop();
Navigator.of(c).pop();
},
child: const Texts('Cancel', fontWeight: FontWeight.w600),
),
Expand All @@ -205,7 +205,7 @@ class _ChatMenuScreenState extends State<ChatMenuScreen> {
await _saveChatHistory();
await _loadChatHistory();
}
Navigator.of(context).pop();
Navigator.of(c).pop();
},
child: const Texts('Save', fontWeight: FontWeight.w600),
),
Expand Down
Loading

0 comments on commit afc1a27

Please sign in to comment.