Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@

// Suppress the warnings that appear for TODOs throughout the codebase.
"dart.showTodos": false,
"java.configuration.updateBuildConfiguration": "interactive",
}
1 change: 1 addition & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ try {
}

android {
ndkVersion "28.0.12916984"
namespace "com.zulip.flutter"

compileSdkVersion flutter.compileSdkVersion
Expand Down
34 changes: 34 additions & 0 deletions lib/widgets/actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -231,3 +231,37 @@ abstract final class ZulipAction {
}
}
}

// Update width calculation to include text content and padding
double calculateMarkerWidth(int number) {
final digitCount = number.toString().length;
final totalCharacters = digitCount + 1; // Number + dot
const characterWidth = 14.0; // Approximate width per character
const rightPadding = 4.0; // Matching the widget's padding
return (totalCharacters * characterWidth) + rightPadding;
}

// Example usage in a widget
Widget buildOrderedList(List<String> items) {
return ListView.builder(
itemCount: items.length,
itemBuilder: (context, index) {
final markerWidth = calculateMarkerWidth(index + 1);
return Row(
children: [
Container(
width: markerWidth,
alignment: Alignment.centerRight,
child: Padding(
padding: const EdgeInsets.only(right: 4.0),
child: Text('${index + 1}.'),
),
),
Expanded(
child: Text(items[index]),
),
],
);
},
);
}
31 changes: 28 additions & 3 deletions lib/widgets/content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,16 @@ class ListNodeWidget extends StatelessWidget {
}
}

// Update the width calculation to match the corrected version from actions.dart
double calculateMarkerWidth(int number) {
final digitCount = number.toString().length;
final totalCharacters = digitCount + 1; // Number + dot
const characterWidth = 14.0; // Approximate width per character
const rightPadding = 4.0; // Matching the widget's padding
return (totalCharacters * characterWidth) + rightPadding;
}

// Update ListItemWidget to use proper width calculation
class ListItemWidget extends StatelessWidget {
const ListItemWidget({super.key, required this.marker, required this.nodes});

Expand All @@ -510,15 +520,29 @@ class ListItemWidget extends StatelessWidget {

@override
Widget build(BuildContext context) {
// Get index from marker instead of parsing string
final index = int.parse(marker.split('.')[0]) - 1;
final markerWidth = calculateMarkerWidth(index + 1);

return Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: localizedTextBaseline(context),
children: [
SizedBox(
width: 20, // TODO handle long numbers in <ol>, like https://github.com/zulip/zulip/pull/25063
width: markerWidth,
child: Align(
alignment: AlignmentDirectional.topEnd, child: Text(marker))),
alignment: AlignmentDirectional.topEnd,
child: Text(marker,
style: TextStyle(
letterSpacing: proportionalLetterSpacing(context,
kButtonTextLetterSpacingProportion,
baseFontSize: 14 // Match base font size
),
),
),
),
),
Expanded(child: BlockContentList(nodes: nodes)),
]);
}
Expand Down Expand Up @@ -1313,7 +1337,8 @@ class MessageTableCell extends StatelessWidget {
? DefaultTextStyle.of(context).style
: DefaultTextStyle.of(context).style
.merge(weightVariableTextStyle(context, wght: 700))),
));
),
);
}
}

Expand Down
2 changes: 2 additions & 0 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import FlutterMacOS
import Foundation

import device_info_plus
import file_picker
import file_selector_macos
import firebase_core
import firebase_messaging
Expand All @@ -19,6 +20,7 @@ import wakelock_plus

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin"))
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#Sat Feb 01 14:51:28 IST 2025
gradle.version=8.9
Empty file.
6 changes: 6 additions & 0 deletions packages/zulip_plugin/pubspec.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages: {}
sdks:
dart: ">=3.4.0-256.0.dev <4.0.0"
flutter: ">=3.3.0"
Loading
Loading