Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
alexteusz committed Jul 11, 2021
1 parent 2e512f2 commit 8b9d66e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 41 deletions.
5 changes: 3 additions & 2 deletions lib/chat_widget/cognigy/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
/// 4. Hard reload the flutter application
/// 5. The green dot at the top right corner should be green (connected)
final String socketUrl = 'https://endpoint-internal.cognigy.ai/';
final String urlToken = '849de509618869b1cf5d14855354b7b81ceb43bd5f5d4a6e72080ddaed9bc3ea';
final String socketUrl = 'https://endpoint-trial.cognigy.ai/';
final String urlToken =
'9f1a8e84514d41f42d4a83d9775ac8d02eb93f6f936b9c35ed1b61ee49a901de';
35 changes: 6 additions & 29 deletions lib/chat_widget/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,25 @@ import 'package:flutter/material.dart';

/// Global application themes.
ThemeData lightTheme = ThemeData(
ThemeData theme = ThemeData(
backgroundColor: Colors.white,
// Define the default brightness and colors.
brightness: Brightness.light,
// bot message bubble color
primaryColor: Colors.grey[600],
primaryColor: Color(0XFF0B3694),
// user message bubble color
accentColor: Colors.grey[200],
accentColor: Colors.grey[100],
// Define the default font family.
fontFamily: 'Helvetica',
fontFamily: 'Muli',
// Define the default TextTheme. Use this to specify the default
// text styling for headlines, titles, bodies of text, and more.
textTheme: TextTheme(
headline5: TextStyle(fontSize: 72.0, fontWeight: FontWeight.bold),
headline6: TextStyle(
fontSize: 20.0, fontWeight: FontWeight.w700, color: Colors.white),
subtitle2: TextStyle(
fontSize: 15.0, fontWeight: FontWeight.w600, color: Colors.white),
fontSize: 16.0, fontWeight: FontWeight.w600, color: Colors.white),
bodyText2:
TextStyle(fontSize: 15.0, fontFamily: 'Helvetica', color: Colors.white),
),
);

ThemeData darkTheme = ThemeData(
backgroundColor: Colors.grey[800],
// Define the default brightness and colors.
brightness: Brightness.dark,
// bot message bubble color
primaryColor: Colors.grey[700],
// user message bubble color
accentColor: Colors.grey[350],
// Define the default font family.
fontFamily: 'Helvetica',
// Define the default TextTheme. Use this to specify the default
// text styling for headlines, titles, bodies of text, and more.
textTheme: TextTheme(
headline5: TextStyle(fontSize: 72.0, fontWeight: FontWeight.bold),
headline6: TextStyle(
fontSize: 20.0, fontWeight: FontWeight.w700, color: Colors.white),
subtitle2: TextStyle(
fontSize: 15.0, fontWeight: FontWeight.w600, color: Colors.white),
bodyText2:
TextStyle(fontSize: 15.0, fontFamily: 'Helvetica', color: Colors.white),
TextStyle(fontSize: 16.0, fontFamily: 'Muli', color: Colors.white),
),
);
15 changes: 9 additions & 6 deletions lib/chat_widget/widgets/chat.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io';

import 'package:cognigy_flutterchat/chat_widget/helper/message_helper.dart';
import 'package:cognigy_flutterchat/main.dart';
import 'package:cognigy_flutterchat/chat_widget/models/message_model.dart';
Expand Down Expand Up @@ -26,7 +28,7 @@ class _ChatState extends State<Chat>
ChatMessage cognigyMessage;
bool isConnected;
bool isRecordingVoice;
bool _hasSpeech;
bool hasSpeech;

final GlobalKey<AnimatedListState> _listKey = GlobalKey<AnimatedListState>();
final SocketService socketService = injector.get<SocketService>();
Expand All @@ -42,7 +44,7 @@ class _ChatState extends State<Chat>
scrollController = ScrollController();
isConnected = false;
isRecordingVoice = false;
_hasSpeech = false;
hasSpeech = false;
focusNode = FocusNode();

handleCognigyConnection();
Expand Down Expand Up @@ -74,7 +76,7 @@ class _ChatState extends State<Chat>

if (!mounted) return;
setState(() {
_hasSpeech = hasSpeech;
hasSpeech = hasSpeech;
});
}

Expand Down Expand Up @@ -138,6 +140,7 @@ class _ChatState extends State<Chat>
padding: const EdgeInsets.only(left: 15.0),
child: TextField(
showCursor: true,
maxLines: null,
cursorRadius: Radius.circular(30),
cursorColor: Theme.of(context).primaryColor,
focusNode: focusNode,
Expand Down Expand Up @@ -192,7 +195,7 @@ class _ChatState extends State<Chat>
child: Icon(
Icons.send,
size: 30,
color: textController.text == '' ? Colors.black12 : Colors.black,
color: Colors.black12,
),
);
}
Expand Down Expand Up @@ -221,7 +224,7 @@ class _ChatState extends State<Chat>
child: Icon(
isRecordingVoice ? Icons.mic_off : Icons.mic,
size: 30,
color: isRecordingVoice ? Colors.black : Colors.black12,
color: Colors.black12,
),
);
}
Expand Down Expand Up @@ -323,7 +326,7 @@ class _ChatState extends State<Chat>
? SizedBox(
height: 20,
child: Container(
color: Theme.of(context).backgroundColor,
color: Colors.transparent,
),
)
: Container(),
Expand Down
13 changes: 9 additions & 4 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,17 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Cognigy Demo',
title: 'Cognigy.AI',
debugShowCheckedModeBanner: false,
theme: lightTheme,
darkTheme: darkTheme,
theme: theme,
home: Scaffold(
appBar: AppBar(elevation: 0, backgroundColor: Colors.white),
appBar: PreferredSize(
preferredSize: Size.fromHeight(5.0), // here the desired height
child: AppBar(
elevation: 0,
backgroundColor: Colors.transparent,
brightness: Brightness.light)),
// appBar: AppBar(elevation: 0, backgroundColor: Colors.white),
body: Chat(),
),
);
Expand Down

0 comments on commit 8b9d66e

Please sign in to comment.