Brennan  Veum

Brennan Veum

1619102640

Vuetify — Complex Drawers

Vuetify is a popular UI framework for Vue apps.

In this article, we’ll look at how to work with the Vuetify framework.

Expand on Hover

We can make a nav drawer than expands on hover.

#javascript

What is GEEK

Buddha Community

Vuetify — Complex Drawers
Tamale  Moses

Tamale Moses

1620930540

Cognitive Complexity Vs Cyclomatic Complexity - An Example With C#a

Background

While writing professional code, code metrics are an important tool to determine that you are writing quality code that would make it easy to test, understand and maintain in the long run, as the code passes from one developer to another. Since every developer has a different style of writing the same logic, it becomes imperative to set up some standard/guidelines or quantitative measures to tell or determine what makes a good quality code. Two of the most relevant ones, that I find very interesting to explore is,

Cyclomatic Complexity and it’s younger sibling Cognitive Complexity!

The concept of Cognitive Complexity was brought in by SonarQube. They wanted to introduce a more contextualized form of measuring the code complexity. While you can read all the artifacts available to you in public domain on both this topic, I would rather summarize it as below, to the best of my understanding of the concepts till now,

Cyclomatic Complexity

Measures, how difficult it is test the code (i.e. Testability)._ Alternatively, this measure is a hint of how many distinct test cases you should write to have 100% code coverage. _

#c#a #cognitive complexity #cyclomatic complexity

Arno  Bradtke

Arno Bradtke

1600123560

Time and Space Complexity of Machine Learning Models

  • **The train time complexity of machine learning model **— The amount of time taken to train the model
  • **The test time complexity of the machine learning model — **Time took to predict output for a given input query point.

Time complexity is an essential aspect to know when anyone wants their model with low latency. Let’s dive deep into details of how much time and space required by the wide variety of models to predict the output.

“Assuming training data has n points with d dimensions “

#space-complexity #machine-learning #time-complexity #logistic-regression #ai

Noah  Rowe

Noah Rowe

1593442500

Big O Notation and Time/Space Complexity

Big O Notation and Time/Space Complexity

Big O notation is a commonly used metric used in computer science to classify algorithms based on their time and space complexity. The time and space here is not based on the actual number of operations performed or amount of memory used per se, but rather how the algorithm would scale with an increase or decrease in the amount of data in the input. The notation will represent how an algorithm will run in the worst-case scenario- what is the maximum time or space an algorithm could use? The complexity is written as O(x) where x is the growth rate of the algorithm in regards to n, which is the amount of data input. Throughout the rest of this blog, input will be referred to as n.

O(1)

O(1) is known as constant complexity. What this implies is that the amount of time or memory does not scale with n at all. For time complexity, this means that n is not iterated on or recursed- generally a value will be selected and returned or a value with be operated on and returned.

Function that returns an index of an array doubled in O(1) time complexity.

For space, no data structures can be created that are a multiples of the size of n. Variables can be declared, but the number must not change with n.

Function that logs every element in an array with O(1) space.

O(logn)

O(logn) is known as logarithmic complexity. The logarithm in O(logn) has a base of 2. The best way to wrap your head around this is to remember the concept of halving: every time n increases by an amount k, the time or space increases by k/2. There are several common algorithms that are O(logn) a vast majority of the time to keep an eye out for: binary search, searching for a term in a binary search tree, and adding items to a heap.

#algorithms #computer-science #big-o-notation #time-complexity #space-complexity #algorithms

Brennan  Veum

Brennan Veum

1619102640

Vuetify — Complex Drawers

Vuetify is a popular UI framework for Vue apps.

In this article, we’ll look at how to work with the Vuetify framework.

Expand on Hover

We can make a nav drawer than expands on hover.

#javascript

Bottom Drawer for Flutter

Bottom Drawer for Flutter 

Bottom Drawer.

DEMO

1. Add dependency

dependencies:
  bottom_drawer: ^0.0.3

2. Import bottom drawer

import 'package:bottom_drawer/bottom_drawer.dart';

3. Use bottom drawer

Create a bottom drawer controller.

/// create a bottom drawer controller to control the drawer.
BottomDrawerController controller = BottomDrawerController();

Build a bottom drawer widget.

/// return a bottom drawer widget.
Widget buildBottomDrawer(BuildContext context) {
  return BottomDrawer(
    /// your customized drawer header.
    header: Container(),
    /// your customized drawer body.
    body: Container(),
    /// your customized drawer header height.
    headerHeight: 60.0,
    /// your customized drawer body height.
    drawerHeight: 180.0,
    /// drawer background color.
    color: Colors.lightBlue,
    /// drawer controller.
    controller: controller,
  );
}

Control the bottom drawer.

/// open the bottom drawer.
controller.open();

/// close the bottom drawer.
controller.close();

For more information, see the example

Use this package as a library

Depend on it

Run this command:

With Flutter:

 $ flutter pub add bottom_drawer

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  bottom_drawer: ^0.0.4

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:bottom_drawer/bottom_drawer.dart'; 

example/lib/main.dart

import 'package:bottom_drawer/bottom_drawer.dart';
import 'package:flutter/material.dart';

/// Created by GP
/// 2020/11/25.

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Bottom drawer example app'),
        ),
        body: Stack(
          children: [
            Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Text('Pressed $_button'),
                Padding(
                  padding: EdgeInsets.only(top: 30.0),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      IconButton(
                        icon: Icon(
                          Icons.arrow_upward,
                          color: Colors.black,
                        ),
                        onPressed: () {
                          _controller.open();
                          setState(() {
                            _button = 'Open Drawer';
                          });
                        },
                      ),
                      Divider(
                        height: 10.0,
                      ),
                      IconButton(
                        icon: Icon(
                          Icons.arrow_downward,
                          color: Colors.black,
                        ),
                        onPressed: () {
                          _controller.close();
                          setState(() {
                            _button = 'Close Drawer';
                          });
                        },
                      ),
                    ],
                  ),
                ),
              ],
            ),
            _buildBottomDrawer(context),
          ],
        ),
      ),
    );
  }

  Widget _buildBottomDrawer(BuildContext context) {
    return BottomDrawer(
      header: _buildBottomDrawerHead(context),
      body: _buildBottomDrawerBody(context),
      headerHeight: _headerHeight,
      drawerHeight: _bodyHeight,
      color: Colors.lightBlue,
      controller: _controller,
      boxShadow: [
        BoxShadow(
          color: Colors.black.withOpacity(0.15),
          blurRadius: 60,
          spreadRadius: 5,
          offset: const Offset(2, -6), // changes position of shadow
        ),
      ],
    );
  }

  Widget _buildBottomDrawerHead(BuildContext context) {
    return Container(
      height: _headerHeight,
      child: Column(
        children: [
          Padding(
            padding: EdgeInsets.only(
              left: 10.0,
              right: 10.0,
              top: 10.0,
            ),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: _buildButtons('', 1, 2),
            ),
          ),
          Spacer(),
          Divider(
            height: 1.0,
            color: Colors.grey,
          ),
        ],
      ),
    );
  }

  Widget _buildBottomDrawerBody(BuildContext context) {
    return Container(
      width: double.infinity,
      height: _bodyHeight,
      child: SingleChildScrollView(
        child: Column(
          children: _buildButtons('Body', 1, 25),
        ),
      ),
    );
  }

  List<Widget> _buildButtons(String prefix, int start, int end) {
    List<Widget> buttons = [];
    for (int i = start; i <= end; i++)
      buttons.add(TextButton(
        child: Text(
          '$prefix Button $i',
          style: TextStyle(
            fontSize: 15.0,
            color: Colors.black,
          ),
        ),
        onPressed: () {
          setState(() {
            _button = '$prefix Button $i';
          });
        },
      ));
    return buttons;
  }

  String _button = 'None';
  double _headerHeight = 60.0;
  double _bodyHeight = 180.0;
  BottomDrawerController _controller = BottomDrawerController();
} 

Download Details:

Author: GP-Moon

Source Code: https://github.com/GP-Moon/bottom_drawer

#flutter #drawer #bottom