Easy Chat Game

pub package Last Commits Pull Requests Code size License

To implement a scripted chat game for fun

Features

  • Support chat game for fun
  • Support light & dark modes

How to use

There are two ways to use Easy Wallpaper.

1: Stand-Alone App mode

void onLaunch() async {
  final result = await Navigator.of(context).push(
    MaterialPageRoute(
        fullscreenDialog: true,
        builder: (_) => EasyChatGameApp(
          title: 'Teacher Chat',
          levels: ChatData.allLevels(),
        )),
  );
  if (result == false) onLaunch();
}

2: Add to Widget-Tree

EasyPrankCallApp(
  title: 'Scary Teacher Prank',
  levels: ChatData.allLevels(),
  placementBuilder: _addPlacements,
  onTapEvent: _onTapEvent,
)

Additional Info

Data Model

Prepare model list and pass it to the EasyChatGameApp() widget.


class ChatData {
  static List<ChatLevel> allLevels() {
    return [
      level1(),
      level2(),
    ];
  }

  static ChatLevel level1() {
    Map<String, List<String>> chatList = {};

    chatList[ChatLevel.botKey] = ['where were you yesterday?'];
    chatList['where were you yesterday?'] = [
      'My dog was sick?(Lie)',
      'Pirates kidnap me(Lie)'
    ];
    chatList['My dog was sick?(Lie)'] = ['You have a dog?'];
    chatList['Pirates kidnap me(Lie)'] = ['Pirates?! In Ohio?'];
    chatList['You have a dog?'] = [
      'No i just overslept(Truth)',
      'Her name is Cindy(Lie)'
    ];
    chatList['No i just overslept(Truth)'] = ['Okay enough you are expelled'];
    chatList['Her name is Cindy(Lie)'] = ['I love dogs but call me next time'];
    chatList['Pirates?! In Ohio?'] = [
      'Yes they are very dangerous',
      'Sounds weird.But it\'s true'
    ];
    chatList['Yes they are very dangerous'] = ['But you are free now. Right?'];
    chatList['Sounds weird.But it\'s true'] = ['But you are free now. Right?'];
    chatList['But you are free now. Right?'] = [
      'I escaped them',
      'they let me go'
    ];
    chatList['I escaped them'] = [
      'i don\'t really believe you! Meet me in my office'
    ];
    chatList['they let me go'] = ['Why?'];
    chatList['Why?'] = ['They were Scared of me', 'I made them my friends'];
    chatList['They were Scared of me'] = [
      'i don\'t really believe you! Meet me in my office'
    ];
    chatList['I made them my friends'] = ['uh, Okay'];
    return ChatLevel(
      levelName: 'Find excuse',
      botName: 'Scary Teacher',
      botImg: 'assets/kids/kid1.png',
      userImg: 'assets/kids/kid1.png',
      chatList: chatList,
      successMessages: [
        'I love dogs but call me next time',
        'Oh it\'s okay. Sorry for bothering you',
        'uh, Okay'
      ],
      failureMessages: [
        'Okay enough you are expelled',
        'i don\'t really believe you! Meet me in my office'
      ],
    );
  }
}

See Example for better understanding.

Authors

Noor Ali Butt

GitHub Follow LinkedIn Link

Hanzla Waheed

GitHub Follow LinkedIn Link

Libraries

easy_chat_game