Add explicit types and improve type safety across codebase

This commit adds explicit type annotations to variables, function parameters, and return types throughout the codebase, particularly in widget trees, Bloc logic, and repository implementations. The changes improve code readability, maintainability, and type safety, and align with Dart best practices. No business logic was changed.
This commit is contained in:
Achintha Isuru
2026-01-24 10:00:36 -05:00
parent ff93bfa4bd
commit f57f41c508
99 changed files with 495 additions and 485 deletions

View File

@@ -160,7 +160,7 @@ class UiButton extends StatelessWidget {
}
// Multiple elements case: Use a Row with MainAxisSize.min
final List<Widget> children = [];
final List<Widget> children = <Widget>[];
if (leadingIcon != null) {
children.add(Icon(leadingIcon, size: iconSize));

View File

@@ -68,21 +68,21 @@ class UiChip extends StatelessWidget {
@override
Widget build(BuildContext context) {
final backgroundColor = _getBackgroundColor();
final contentColor = _getContentColor();
final textStyle = _getTextStyle().copyWith(color: contentColor);
final padding = _getPadding();
final iconSize = _getIconSize();
final Color backgroundColor = _getBackgroundColor();
final Color contentColor = _getContentColor();
final TextStyle textStyle = _getTextStyle().copyWith(color: contentColor);
final EdgeInsets padding = _getPadding();
final double iconSize = _getIconSize();
final content = Row(
final Row content = Row(
mainAxisSize: MainAxisSize.min,
children: [
if (leadingIcon != null) ...[
children: <Widget>[
if (leadingIcon != null) ...<Widget>[
Icon(leadingIcon, size: iconSize, color: contentColor),
SizedBox(width: _getGap()),
],
Text(label, style: textStyle),
if (trailingIcon != null) ...[
if (trailingIcon != null) ...<Widget>[
SizedBox(width: _getGap()),
GestureDetector(
onTap: onTrailingIconTap,

View File

@@ -35,7 +35,7 @@ class UiStepIndicator extends StatelessWidget {
padding: const EdgeInsets.symmetric(vertical: UiConstants.space2),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(stepIcons.length, (index) {
children: List.generate(stepIcons.length, (int index) {
final bool isActive = index == currentStep;
final bool isCompleted = index < currentStep;
@@ -53,7 +53,7 @@ class UiStepIndicator extends StatelessWidget {
}
return Row(
children: [
children: <Widget>[
Container(
width: 40,
height: 40,

View File

@@ -81,8 +81,8 @@ class UiTextField extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
if (label != null) ...[
children: <Widget>[
if (label != null) ...<Widget>[
Text(label!, style: UiTypography.body4m.textSecondary),
const SizedBox(height: UiConstants.space1),
],