Widget createCardsSuggestion()

in frontend/frontend-flutter/lib/main.dart [1717:1851]


  Widget createCardsSuggestion(
      {required String? title,
      required String text,
      required int scenarioNumber,
      required bool isHovered,
      required String imagePath,
      required String timeStamp,
      required String userGrouping}) {
    print('Main : createCardsSuggestion() : START');
    print('Main : createCardsSuggestion() : START : text = $text');
    print('Main : createCardsSuggestion() : START : title = $title');
    print('Main : createCardsSuggestion() : START : userGrouping = $userGrouping');
    return Expanded(
      child: InkWell(
        onTap: () {
          print(
              'Main : createCardsSuggestion() : TextButton : onPressed() : START : text = $text');

          textEditingController.text = text;
          _isFirstQuestionNotAskedYet = false;
          //Use the user_grouping associated to the question
          //selectedValueNotifier.value = title;
          selectedValueNotifier.value = userGrouping;

          //Setting the current user_grouping value
          TextToDocParameter.currentUserGrouping = userGrouping;

          BlocProvider.of<NewSuggestionCubit>(context).generateNewSuggestions(
              scenarioNumber, text,
              isACannedQuestion: false,
          userGrouping: userGrouping);
        },
        onHover: (value) {

        },
        child: Container(
          width: screenSize!.width / 2.5,
          height: screenSize!.height / 6,
          child: Card(
            color: Colors.white,
            elevation: 0,
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(10),
            ),
            // Define how the card's content should be clipped
            clipBehavior: Clip.antiAliasWithSaveLayer,
            // Define the child widget of the card
            child: Padding(
              padding: const EdgeInsets.all(10),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.start,
                mainAxisSize: MainAxisSize.max,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Image.asset(
                    imagePath!,
                    height: 50,
                    width: 50,
                    fit: BoxFit.cover,
                  ),
                  Container(width: 20),
                  Flexible(
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      //mainAxisSize: MainAxisSize.max,
                      children: <Widget>[
                        // Add some spacing between the top of the card and the title
                        Container(height: 5),
                        // Add a title widget
                        Flexible(
                          //flex: 1,
                          child: Container(
                            color: isHovered ? Colors.blueGrey : null,
                            child: Text(
                              title!,
                              style: TextStyle(
                                  fontSize: 18,
                                  fontWeight: FontWeight.bold,
                                  color: Color(0xFF37474F)),
                            ),
                          ),
                        ),
                        // Add some spacing between the title and the subtitle
                        Container(height: 5),
                        // Add some spacing between the subtitle and the text
                        // Add a text widget to display some text
                        Flexible(
                          //flex: 6,
                          child: Container(
                            color: isHovered ? Colors.blueGrey : null,
                            child: Text(
                              text,
                              style: Theme.of(context)
                                  .textTheme
                                  .titleMedium!
                                  .copyWith(
                                    color: Colors.grey[700],
                                  ),
                              maxLines: 6,
                              softWrap: true,
                              overflow: TextOverflow.visible,
                            ),
                          ),
                        ),
                        Container(height: 10),
                        Flexible(
                          //flex: 6,
                          child: Container(
                            padding: EdgeInsets.only(top: 5),
                            color: isHovered ? Colors.blueGrey : null,
                            child: Text(
                              'Question typed on the ' + timeStamp,
                              style: Theme.of(context)
                                  .textTheme
                                  .titleSmall!
                                  .copyWith(
                                    color: Colors.blueAccent,
                                  ),
                              maxLines: 6,
                              softWrap: true,
                              overflow: TextOverflow.visible,
                            ),
                          ),
                        ),
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }