Skip to content

Commit

Permalink
migrated withOpacity to withAlpha
Browse files Browse the repository at this point in the history
  • Loading branch information
Satyam Jha committed Jan 28, 2025
1 parent 903a3bc commit 90b468d
Show file tree
Hide file tree
Showing 28 changed files with 53 additions and 47 deletions.
2 changes: 1 addition & 1 deletion lib/custom_painters/language_icon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ class LanguageIcon extends CustomPainter {
path_0.close();

final Paint paint0fill = Paint()..style = PaintingStyle.fill;
paint0fill.color = const Color(0xff737373).withOpacity(1.0);
paint0fill.color = const Color(0xff737373).withAlpha((1.0*255).toInt());
canvas.drawPath(path_0, paint0fill);
}

Expand Down
8 changes: 4 additions & 4 deletions lib/custom_painters/talawa_logo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class AppLogo extends CustomPainter {
path_0.close();

final Paint paint0fill = Paint()..style = PaintingStyle.fill;
paint0fill.color = const Color(0xff31BB6B).withOpacity(1.0);
paint0fill.color = const Color(0xff31BB6B).withAlpha((1.0 * 255).toInt());
canvas.drawPath(path_0, paint0fill);

final Path path_1 = Path();
Expand Down Expand Up @@ -270,7 +270,7 @@ class AppLogo extends CustomPainter {
path_1.close();

final Paint paint1fill = Paint()..style = PaintingStyle.fill;
paint1fill.color = const Color(0xffFEBC59).withOpacity(1.0);
paint1fill.color = const Color(0xffFEBC59).withAlpha((1.0 * 255).toInt());
canvas.drawPath(path_1, paint1fill);

final Path path_2 = Path();
Expand Down Expand Up @@ -342,7 +342,7 @@ class AppLogo extends CustomPainter {
path_2.close();

final Paint paint2fill = Paint()..style = PaintingStyle.fill;
paint2fill.color = const Color(0xff737373).withOpacity(1.0);
paint2fill.color = const Color(0xff737373).withAlpha((1.0 * 255).toInt());
canvas.drawPath(path_2, paint2fill);

final Path path_3 = Path();
Expand Down Expand Up @@ -422,7 +422,7 @@ class AppLogo extends CustomPainter {
path_3.close();

final Paint paint3fill = Paint()..style = PaintingStyle.fill;
paint3fill.color = const Color(0xff737373).withOpacity(1.0);
paint3fill.color = const Color(0xff737373).withAlpha((1.0 * 255).toInt());
canvas.drawPath(path_3, paint3fill);
}

Expand Down
12 changes: 6 additions & 6 deletions lib/custom_painters/telegram_logo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class TelegramLogo extends CustomPainter {
paint0Fill.shader = ui.Gradient.linear(
Offset(size.width * 0.6670000, size.height * 0.1670000),
Offset(size.width * 0.4170000, size.height * 0.7500000), [
const Color(0xff37aee2).withOpacity(1),
const Color(0xff1e96c8).withOpacity(1),
const Color(0xff37aee2).withAlpha((1.0 * 255).toInt()),
const Color(0xff1e96c8).withAlpha((1.0 * 255).toInt()),
], [
0,
1,
Expand All @@ -43,7 +43,7 @@ class TelegramLogo extends CustomPainter {
path_1.lineTo(size.width * 0.7083333, size.height * 0.3333333);

final Paint paint1Fill = Paint()..style = PaintingStyle.fill;
paint1Fill.color = const Color(0xffc8daea).withOpacity(1.0);
paint1Fill.color = const Color(0xffc8daea).withAlpha((1.0 * 255).toInt());
canvas.drawPath(path_1, paint1Fill);

final Path path_2 = Path();
Expand All @@ -60,7 +60,7 @@ class TelegramLogo extends CustomPainter {
path_2.lineTo(size.width * 0.4168417, size.height * 0.6016958);

final Paint paint2Fill = Paint()..style = PaintingStyle.fill;
paint2Fill.color = const Color(0xffa9c9dd).withOpacity(1.0);
paint2Fill.color = const Color(0xffa9c9dd).withAlpha((1.0 * 255).toInt());
canvas.drawPath(path_2, paint2Fill);

final Path path_3 = Path();
Expand Down Expand Up @@ -107,8 +107,8 @@ class TelegramLogo extends CustomPainter {
paint3Fill.shader = ui.Gradient.linear(
Offset(size.width * 0.6600000, size.height * 0.4370000),
Offset(size.width * 0.8510000, size.height * 0.8020000), [
const Color(0xffeff7fc).withOpacity(1),
const Color(0xffffffff).withOpacity(1),
const Color(0xffeff7fc).withAlpha((1.0 * 255).toInt()),
const Color(0xffffffff).withAlpha((1.0 * 255).toInt()),
], [
0,
1,
Expand Down
4 changes: 2 additions & 2 deletions lib/custom_painters/whatsapp_logo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class WhatsappLogo extends CustomPainter {
);

final Paint paint0Fill = Paint()..style = PaintingStyle.fill;
paint0Fill.color = const Color(0xff40c351).withOpacity(1.0);
paint0Fill.color = const Color(0xff40c351).withAlpha((1.0 * 255).toInt());
canvas.drawPath(path_0, paint0Fill);

final Path path_1 = Path();
Expand Down Expand Up @@ -422,7 +422,7 @@ class WhatsappLogo extends CustomPainter {
path_1.close();

final Paint paint1fill = Paint()..style = PaintingStyle.fill;
paint1fill.color = const Color(0xfffcfcfc).withOpacity(1.0);
paint1fill.color = const Color(0xfffcfcfc).withAlpha((1.0 * 255).toInt());
canvas.drawPath(path_1, paint1fill);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/services/navigation_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class NavigationService {
Icons.error_outline,
color: Colors.redAccent,
),
color: Colors.black.withOpacity(0.8),
color: Colors.black.withAlpha((1.0 * 255).toInt()),
);
},
).show(navigatorKey.currentContext!);
Expand Down
2 changes: 1 addition & 1 deletion lib/view_model/access_request_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class AccessScreenViewModel extends BaseModel {
);
if (result.data != null) {
final OrgInfo membershipRequest = OrgInfo.fromJson(
((result.data!)['sendMembershipRequest']
(result.data!['sendMembershipRequest']
as Map<String, dynamic>)['organization'] as Map<String, dynamic>,
);
userConfig.updateUserMemberRequestOrg([membershipRequest]);
Expand Down
4 changes: 2 additions & 2 deletions lib/view_model/main_screen_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class MainScreenViewModel extends BaseModel {
currentPageIndex = mainScreenIndex;
showAppTour = fromSignUp || demoMode;
context = ctx;

final appTourDialogWidget = appTourDialog(ctx);
print(ctx);
print(context);
pluginPrototypeData = {
Expand All @@ -196,7 +196,7 @@ class MainScreenViewModel extends BaseModel {
Future.delayed(
const Duration(seconds: 1),
() => navigationService.pushDialog(
appTourDialog(ctx),
appTourDialogWidget,
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class _ChatInputFieldState extends State<ChatInputField> {
BoxShadow(
offset: const Offset(0, 4),
blurRadius: 32,
color: const Color(0xFF087949).withOpacity(0.08),
color: const Color(0xFF087949).withAlpha((0.08 * 255).toInt()),
),
],
),
Expand Down Expand Up @@ -94,7 +94,7 @@ class _ChatInputFieldState extends State<ChatInputField> {
.textTheme
.bodyLarge!
.color!
.withOpacity(0.64),
.withAlpha((0.64 * 255).toInt()),
),
),
// Placeholder text for the text field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class _EditAgendaItemPageState extends State<EditAgendaItemPage> {
Icons.error_outline,
color: Colors.redAccent,
),
color: Colors.black.withOpacity(0.8),
color: Colors.black.withAlpha((0.8 * 255).toInt()),
);
},
).show(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ManageAgendaScreen extends StatelessWidget {
Icons.error_outline,
color: Colors.redAccent,
),
color: Colors.black.withOpacity(0.8),
color: Colors.black.withAlpha((0.8 * 255).toInt()),
);
},
).show(context);
Expand Down
2 changes: 1 addition & 1 deletion lib/views/after_auth_screens/feed/individual_post.dart
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class CommentTemplate extends StatelessWidget {
Expanded(
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).iconTheme.color!.withOpacity(0.2),
color: Theme.of(context).iconTheme.color!.withAlpha((0.2 * 255).toInt()),
borderRadius: const BorderRadius.all(Radius.circular(8)),
),
padding: const EdgeInsets.all(16.0),
Expand Down
4 changes: 2 additions & 2 deletions lib/views/after_auth_screens/org_info_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class OrganisationInfoScreen extends StatelessWidget {
height: imageHeight,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.55),
color: Colors.black.withAlpha((0.55 * 255).toInt()),
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(20.0),
bottomRight: Radius.circular(20.0),
Expand Down Expand Up @@ -341,7 +341,7 @@ class OrganisationInfoScreen extends StatelessWidget {
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
color: Colors.grey.withAlpha((0.5 * 255).toInt()),
spreadRadius: 1,
blurRadius:
Theme.of(context).brightness == Brightness.dark
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class _EditProfilePageState extends State<EditProfilePage> {
: null,
backgroundColor:
model.imageFile == null && model.user.image == null
? Colors.grey.withOpacity(0.2)
? Colors.grey.withAlpha((0.2 * 255).toInt())
: null,
child: model.imageFile == null
? model.user.image == null
Expand Down
2 changes: 1 addition & 1 deletion lib/views/pre_auth_screens/select_language.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class _SelectLanguageState extends State<SelectLanguage> {
decoration: BoxDecoration(
color: languages[index].langCode ==
appLang.appLocal.languageCode
? const Color(0xFFC4C4C4).withOpacity(0.15)
? const Color(0xFFC4C4C4).withAlpha((0.15 * 255).toInt())
: Colors.transparent,
),
child: index == 0
Expand Down
2 changes: 1 addition & 1 deletion lib/views/pre_auth_screens/set_url.dart
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class _SetUrlState extends State<SetUrl> {
color: Theme.of(context)
.colorScheme
.surface
.withOpacity(0.8),
.withAlpha((0.8 * 255).toInt()),
),
),
],
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/agenda_item_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class ExpandableAgendaItemTile extends StatelessWidget {
return GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: ColoredBox(
color: Colors.black.withOpacity(0.5),
color: Colors.black.withAlpha((0.5 * 255).toInt()),
child: Center(
child: InteractiveViewer(
panEnabled: true,
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/create_recurring_event_helper_widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class _EventEndOptionsState extends State<EventEndOptions> {
: TextStyle(
color: Theme.of(context)
.dividerColor
.withOpacity(0.4),
.withAlpha((0.4 * 255).toInt()),
),
),
),
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/custom_avatar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class CustomAvatar extends StatelessWidget {
//creating the avatar with the icon-theme color when the image is null
? CircleAvatar(
backgroundColor:
Theme.of(context).iconTheme.color!.withOpacity(0.2),
Theme.of(context).iconTheme.color!.withAlpha((0.2 * 255).toInt()),
maxRadius: maxRadius,
child: Center(
child: Text(
Expand All @@ -60,7 +60,7 @@ class CustomAvatar extends StatelessWidget {
imageBuilder: (context, imageProvider) {
return CircleAvatar(
backgroundColor:
Theme.of(context).iconTheme.color!.withOpacity(0.2),
Theme.of(context).iconTheme.color!.withAlpha((0.2 * 255).toInt()),
backgroundImage: imageProvider,
);
},
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/custom_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class CustomListTile extends StatelessWidget {
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
color: Colors.grey.withAlpha((0.5 * 255).toInt()),
spreadRadius: 1,
blurRadius: 6,
offset: const Offset(0, 3),
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/custom_weekday_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class _CustomWeekDaySelectorState extends State<CustomWeekDaySelector> {
height: 30,
decoration: BoxDecoration(
color: weekdays.contains(weekday)
? Theme.of(context).colorScheme.primary.withOpacity(0.5)
? Theme.of(context).colorScheme.primary.withAlpha((0.5 * 255).toInt())
: Colors.transparent,
border: Border.all(
width: weekdays.contains(weekday) ? 2 : 1,
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/event_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class EventCard extends StatelessWidget {
height: SizeConfig.screenHeight! * 0.11,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.grey.withOpacity(0.3),
color: Colors.grey.withAlpha((0.3 * 255).toInt()),
image: const DecorationImage(
fit: BoxFit.fitWidth,
alignment: FractionalOffset.topCenter,
Expand All @@ -68,7 +68,7 @@ class EventCard extends StatelessWidget {
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
child: Container(
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.0),
color: Colors.white.withAlpha((0.0 * 255).toInt()),
),
),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/pinned_carousel_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class PinnedPostCarousel extends StatelessWidget {
Container(
height: 220,
color:
Theme.of(context).colorScheme.primaryContainer.withOpacity(0.5),
Theme.of(context).colorScheme.primaryContainer.withAlpha((0.5 * 255).toInt()),
child: CustomCarouselScroller(
pinnedPosts: pinnedPosts,
key: const Key('Carousel'),
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/venue_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class VenueCard extends StatelessWidget {
),
elevation: 3,
color: isSelected
? Colors.blue.withOpacity(0.3)
? Colors.blue.withAlpha((0.3 * 255).toInt())
: Theme.of(context).primaryColor,
child: Column(
children: [
Expand All @@ -47,7 +47,7 @@ class VenueCard extends StatelessWidget {
height: SizeConfig.screenHeight! * 0.11,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.grey.withOpacity(0.3),
color: Colors.grey.withAlpha((0.3 * 255).toInt()),
image: DecorationImage(
fit: BoxFit.fitWidth,
alignment: FractionalOffset.topCenter,
Expand Down
12 changes: 9 additions & 3 deletions talawa_lint/lib/talawa_api_doc/talawa_api_doc_fixer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ class TalawaAPIDocFixer extends DartFix {
node.offset,
node.leftBracket.offset - node.offset,
),
)) return;
)) {
return;
}

// The same issue exists for Functions and Methods. We can define functions
// inside functions, and the same overlap of [SourceRange] occurs due to that
Expand All @@ -95,7 +97,9 @@ class TalawaAPIDocFixer extends DartFix {
node.name.length + node.name.offset) -
node.offset,
),
)) return;
)) {
return;
}

if (node is MethodDeclaration &&
!analysisError.sourceRange.intersects(
Expand All @@ -104,7 +108,9 @@ class TalawaAPIDocFixer extends DartFix {
(node.parameters?.offset ?? node.name.length + node.name.offset) -
node.offset,
),
)) return;
)) {
return;
}

final changeBuilder = reporter.createChangeBuilder(
message: 'Insert Doc skeleton',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ void main() {
// Verify toast styling
final ToastCard toastCard =
tester.widget<ToastCard>(find.byType(ToastCard));
expect(toastCard.color, Colors.black.withOpacity(0.8));
expect(toastCard.color, Colors.black.withAlpha((0.8 * 255).toInt()));

// Wait for auto-dismiss
await tester.pump(const Duration(seconds: 2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Future<void> main() async {

expect(
(tester.firstWidget(findAppNameWidget) as Container).decoration,
BoxDecoration(color: const Color(0xFFC4C4C4).withOpacity(0.15)),
BoxDecoration(color: const Color(0xFFC4C4C4).withAlpha((0.15 * 255).toInt())),
);
});
testWidgets("Testing to navigate to MainScreen", (tester) async {
Expand Down Expand Up @@ -255,7 +255,7 @@ Future<void> main() async {

expect(
(tester.firstWidget(findAppNameWidget) as Container).decoration,
BoxDecoration(color: const Color(0xFFC4C4C4).withOpacity(0.15)),
BoxDecoration(color: const Color(0xFFC4C4C4).withAlpha((0.15 * 255).toInt())),
);
});
testWidgets("Testing to select and navigate button appears",
Expand Down
2 changes: 1 addition & 1 deletion test/widget_tests/widgets/agenda_item_tile_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ void main() {
find.byWidgetPredicate(
(widget) =>
widget is ColoredBox &&
widget.color == Colors.black.withOpacity(0.5),
widget.color == Colors.black.withAlpha((0.5 * 255).toInt()),
),
findsOneWidget,
);
Expand Down
Loading

0 comments on commit 90b468d

Please sign in to comment.