Skip to content

Commit

Permalink
Improve scroll behaviour on mobile devices
Browse files Browse the repository at this point in the history
  • Loading branch information
1runeberg committed Aug 23, 2024
1 parent 9a4ab1d commit 99ba84b
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions confichat/lib/ui_add_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class AddModelDialogState extends State<AddModelDialog> {

child: SingleChildScrollView(
scrollDirection: Axis.vertical,
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,

child: SizedBox(width: 400, height: 300,
child: Column(
Expand Down
1 change: 1 addition & 0 deletions confichat/lib/ui_advanced_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class AdvancedOptionsState extends State<AdvancedOptions> {
maxHeight: AppData.instance.getUserDeviceType(context) == UserDeviceType.phone ? 250.0 : 500, ),
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
child: Column(
children: [

Expand Down
4 changes: 3 additions & 1 deletion confichat/lib/ui_app_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ class AppSettingsState extends State<AppSettings> {
const SizedBox(height: 18),

SingleChildScrollView(
scrollDirection: Axis.vertical, child: Column ( children: [
scrollDirection: Axis.vertical,
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
child: Column ( children: [

// Clear messages
SwitchListTile(
Expand Down
1 change: 1 addition & 0 deletions confichat/lib/ui_canvass.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ class CanvassState extends State<Canvass> {
controller: _scrollController,
itemCount: chatData.length,
reverse: true,
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
padding: const EdgeInsets.all(8),

itemBuilder: (context, index) {
Expand Down
1 change: 1 addition & 0 deletions confichat/lib/ui_config_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class ModelConfigDialogState extends State<ModelConfigDialog> {
content: SizedBox(
width: 400,
child: SingleChildScrollView(
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Expand Down
4 changes: 3 additions & 1 deletion confichat/lib/ui_llamacpp_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ class LlamaCppOptionsState extends State<LlamaCppOptions> {
maxHeight: widget.appData.getUserDeviceType(context) != UserDeviceType.phone ? 400 : 250,
),
child: SingleChildScrollView(
scrollDirection: Axis.vertical, child: Column ( children: [
scrollDirection: Axis.vertical,
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
child: Column ( children: [

// Scheme
const SizedBox(height: 16),
Expand Down
1 change: 1 addition & 0 deletions confichat/lib/ui_ollama_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class OllamaOptionsState extends State<OllamaOptions> {
maxHeight: widget.appData.getUserDeviceType(context) != UserDeviceType.phone ? 400 : 250,
),
child: SingleChildScrollView(
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
scrollDirection: Axis.vertical, child: Column ( children: [

// Scheme
Expand Down
3 changes: 2 additions & 1 deletion confichat/lib/ui_save_session.dart
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ class SaveChatSessionState extends State<SaveChatSession> {
return AlertDialog(
title: const DialogTitle(title: 'Save Chat Session'),
content: SingleChildScrollView(
scrollDirection: Axis.vertical,
scrollDirection: Axis.vertical,
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
child: ConstrainedBox( constraints:
const BoxConstraints(
minWidth: 300,
Expand Down
1 change: 1 addition & 0 deletions confichat/lib/ui_sidebar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class SidebarState extends State<Sidebar> {
maxHeight: 400.0,
),
child: SingleChildScrollView(
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
child: Column(
children: _chatSessionFiles.map((filename) {
return ListTile(
Expand Down
9 changes: 5 additions & 4 deletions confichat/lib/ui_widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,8 @@ class ChatBubble extends StatelessWidget {

child: Container(
color: isUser? Colors.blue[50] : Colors.amber[100],
margin: const EdgeInsets.all(3),
margin: AppData.instance.getUserDeviceType(context) == UserDeviceType.desktop ?
const EdgeInsets.all(3) : const EdgeInsets.symmetric(horizontal: 3, vertical: 8).copyWith(right: 10),

child:
Row (
Expand All @@ -428,9 +429,9 @@ class ChatBubble extends StatelessWidget {
// Text
const SizedBox(width:20),
Expanded(
child: SelectionArea(
child: Container(
margin: const EdgeInsets.all(5),
child: SelectionArea(
child: Markdown(
data: sanitizedText,
builders: {
Expand All @@ -444,8 +445,8 @@ class ChatBubble extends StatelessWidget {
),
),
)
) )
),
)
)),

// Cancel
if (!isUser && animateIcon && indexProcessing != null)
Expand Down

0 comments on commit 99ba84b

Please sign in to comment.