App Brewery Banner

Quizzler ❓

我们的目标

在本教程中,我们将回顾有状态组件和无状态组件,以及学习面向对象编程 (OOP) 的基本构建块——类和对象。

你将要创建什么

我们将创建一个测验应用程序来测试您的常识。作为应用商店中最受欢迎的应用程序类型之一,您可以为其他人创建自己的测验!

Finished App

你将学到什么

  • 将代码模块化为单独的类。
  • Dart 类和对象。
  • 使用类构造函数。
  • 提取组件以重构您的代码。
  • Dart 中的私有和公共修饰符。
  • 如何使用 Dart 列表。
  • var、const 和 final 之间的区别。

项目代码片段

Question('Some cats are actually allergic to humans', true),
    Question('You can lead a cow down stairs but not up stairs.', false),
    Question('Approximately one quarter of human bones are in the feet.', true),
    Question('A slug\'s blood is green.', true),
    Question('Buzz Aldrin\'s mother\'s maiden name was \"Moon\".', true),
    Question('It is illegal to pee in the Ocean in Portugal.', true),
    Question(
        'No piece of square dry paper can be folded in half more than 7 times.',
        false),
    Question(
        'In London, UK, if you happen to die in the House of Parliament, you are technically entitled to a state funeral, because the building is considered too sacred a place.',
        true),
    Question(
        'The loudest sound produced by any animal is 188 decibels. That animal is the African Elephant.',
        false),
    Question(
        'The total surface area of two human lungs is approximately 70 square metres.',
        true),
    Question('Google was originally called \"Backrub\".', true),
    Question(
        'Chocolate affects a dog\'s heart and nervous system; a few ounces are enough to kill a small dog.',
        true),
    Question(
        'In West Virginia, USA, if you accidentally hit an animal with your car, you are free to take it home to eat.',
        true),

GitHub

https://github.com/pedrozopayares/quizzler-flutter