danimaaan

Rocketseat

Apr 21st, 2021
826
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import 'package:DevQuiz/core/core.dart';
  2. import 'package:flutter/material.dart';
  3.  
  4. class AwnserWidget extends StatelessWidget {
  5.   final String title;
  6.   final bool isRight;
  7.   final bool isSelected;
  8.  
  9.   const AwnserWidget({
  10.     Key? key,
  11.     required this.title,
  12.     this.isRight = false,
  13.     this.isSelected = false,
  14.   }) : super(key: key);
  15.  
  16.   Color get _selectedColorRight =>
  17.       isRight ? AppColors.darkGreen : AppColors.darkRed;
  18.  
  19.   Color get _selectedBorderRight =>
  20.       isRight ? AppColors.lightGreen : AppColors.lightRed;
  21.  
  22.   Color get _selectedColorCardRight =>
  23.       isRight ? AppColors.lightGreen : AppColors.lightRed;
  24.  
  25.   Color get _selectedBorderCardRight =>
  26.       isRight ? AppColors.green : AppColors.red;
  27.  
  28.   TextStyle get _selectedTextStyleRight =>
  29.       isRight ? AppTextStyles.bodyDarkGreen : AppTextStyles.bodyDarkRed;
  30.  
  31.   IconData get _selectedIconRight => isRight ? Icons.check : Icons.close;
  32.  
  33.   @override
  34.   Widget build(BuildContext context) {
  35.     return Padding(
  36.       padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
  37.       child: Container(
  38.         padding: EdgeInsets.all(16),
  39.         decoration: BoxDecoration(
  40.             color: isSelected ? _selectedColorCardRight : AppColors.white,
  41.             borderRadius: BorderRadius.circular(10),
  42.             border: Border.fromBorderSide(BorderSide(
  43.               color: isSelected ? _selectedBorderCardRight : AppColors.border,
  44.             ))),
  45.         child: Row(
  46.           mainAxisAlignment: MainAxisAlignment.spaceBetween,
  47.           children: [
  48.             Expanded(
  49.               child: Text(
  50.                 title,
  51.                 style:
  52.                     isSelected ? _selectedTextStyleRight : AppTextStyles.body,
  53.               ),
  54.             ),
  55.             Container(
  56.               width: 24,
  57.               height: 24,
  58.               decoration: BoxDecoration(
  59.                   color: isSelected ? _selectedColorRight : AppColors.white,
  60.                   borderRadius: BorderRadius.circular(500),
  61.                   border: Border.fromBorderSide(
  62.                     BorderSide(
  63.                       color:
  64.                           isSelected ? _selectedBorderRight : AppColors.border,
  65.                     ),
  66.                   )),
  67.               child: isSelected
  68.                   ? Icon(
  69.                       _selectedIconRight,
  70.                       color: AppColors.white,
  71.                       size: 16,
  72.                     )
  73.                   : null,
  74.             )
  75.           ],
  76.         ),
  77.       ),
  78.     );
  79.   }
  80. }
  81.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×