docs: explain and comment code

This commit is contained in:
detherminal 2023-05-26 22:25:59 +03:00
parent 84ac798bb8
commit 97e25a73be
5 changed files with 33 additions and 1 deletions

View file

@ -24,6 +24,11 @@ import 'package:tuple/tuple.dart';
part '../queries/queries.dart';
/*
* This file includes the functions that are used to interact with the main database.
* To add a new function, add it in the class MainDB.
*/
class MainDB {
MainDB._();
static MainDB? _instance;

View file

@ -165,6 +165,11 @@ import 'package:tuple/tuple.dart';
import 'models/isar/models/contact_entry.dart';
/*
* This file contains all the routes for the app.
* To add a new route, add it to the switch statement in the generateRoute method.
*/
class RouteGenerator {
static const bool useMaterialPageRoute = true;

View file

@ -34,6 +34,18 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
import 'package:stackwallet/utilities/prefs.dart';
/*
* This file implements the CoinServiceAPI abstract class that is used by wallet files to implement the coin specific functionality.
* @param coin: The coin type
* @param walletId: The wallet id
* @param walletName: The wallet name
* @param secureStorageInterface: The interface for securely storing data like private keys, mnemonics, passphrases, etc.
* @param node: The node to connect to
* @param tracker: The transaction notification tracker
* @param prefs: The preferences
* @return: The coin service API
*/
abstract class CoinServiceAPI {
CoinServiceAPI();

View file

@ -13,6 +13,7 @@ import 'package:stackwallet/db/isar/main_db.dart';
import 'package:stackwallet/models/isar/models/block_explorer.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
// Returns the default block explorer URL for the given coin and txid
Uri getDefaultBlockExplorerUrlFor({
required Coin coin,
required String txid,
@ -59,7 +60,7 @@ Uri getDefaultBlockExplorerUrlFor({
}
}
/// returns internal Isar ID for the inserted object/record
// Returns internal Isar ID for the inserted object/record
Future<int> setBlockExplorerForCoin({
required Coin coin,
required Uri url,
@ -72,6 +73,7 @@ Future<int> setBlockExplorerForCoin({
);
}
// Returns the block explorer URL for the given coin and txid
Uri getBlockExplorerTransactionUrlFor({
required Coin coin,
required String txid,

View file

@ -24,6 +24,14 @@ import 'package:stackwallet/widgets/background.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
/*
* This widget is used to choose a coin from a list of coins.
* @param title: The title of the page.
* @param coinAdditional: Additional text to be displayed after the coin name.
* @param nextRouteName: The name of the route to be pushed when a coin is selected.
* @return A widget that displays a list of coins.
*/
class ChooseCoinView extends ConsumerStatefulWidget {
const ChooseCoinView({
Key? key,