Giter VIP home page Giter VIP logo

shadcn-ui's Introduction

Flutter ShadcnUI

License: MIT GitHub stars GitHub issues GitHub pull-requests shadcn_ui Pub Version (including pre-releases)

ShadcnUI ported in Flutter. Awesome UI components for Flutter, fully customizable.

Documentation

See the documentation to interact with the components and see the code.

Progress

Follow the progress on X (Twitter)

shadcn-ui's People

Contributors

cjamcu avatar dickermoshe avatar dredayduncan avatar louis-sicko avatar nank1ro avatar pietervdw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shadcn-ui's Issues

Placeholder ShadInputFormField look like not centered

i use setup

    ShadApp.materialRouter(
      debugShowCheckedModeBanner: false,
      title: 'Feel Better',
      routerConfig: _router,
    );

but when use input placeholder look like not centered on vertical

       ShadInputFormField(
          id: 'name',
          label: const Text('What Happened'),
          placeholder: const Text('Meet My Dad'),
          controller: editingName,
          validator: (v) {
            if (v.length < 2) {
              return 'must be at least 2 characters.';
            }
            return null;
          },
        ),
Screenshot 2024-04-03 at 06 09 24 Screenshot 2024-04-03 at 06 09 17

From Google Fonts

Google Fonts & Flutter do not work together nicely at all.
There are a bunch of problems with font weights.
If there is gonna be a func named fromGoogleFonts, it would be really nice if it used all the workarounds to get it working correctly out of the box.

Mike Rystrom and Luke Pighetti would know the details.
I just know that every time I've used google_fonts I ran into bugs that the Flutter and Google Fonts team marked as wont fix.

Button Issues

I plan on going through each component and comparing it the materials implementation to see if anything is missing.
If you rather me do this elsewhere please let me know, I will modify this issue as I find more things.

  • Eplicitly setting onPressed to null doesn't give a disabled button look. This is a really neat part from Materials button & would be nice to have here.
  • Long press is not implemented
  • No way to listen to MaterialStates. I hate the states controller as much as the next guy, but listening to hover could be helpful.

Add Issue template

A template where you ask users to put in an output of flutter doctor...
Prob just copy from flutter repo

ShadTable width problems on Flutter Web using 'RemainingTableSpanExtent'

Hello,

I implemented the ShadTable into a prototype project and experiencing an weird behaviour with the "RemainingTableSpanExtent".

On mobile the middle column of the table expands perfectly fine.
image

On web I experience the following:
image

Code:

import 'package:prototype_app/components/appbar.dart';
import 'package:prototype_app/components/timesheet_card.dart';
import 'package:prototype_app/theme.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:shadcn_ui/shadcn_ui.dart';

var timesheets = [
  (
    date: DateTime.now(),
    startTime: "7:00",
    endTime: "16:00",
    timeBreak: "1:00",
  ),
  (
    date: DateTime.now(),
    startTime: "7:00",
    endTime: "16:00",
    timeBreak: "1:00",
  ),
  (
    date: DateTime.now(),
    startTime: "7:00",
    endTime: "16:00",
    timeBreak: "1:00",
  ),
  (
    date: DateTime.now(),
    startTime: "7:00",
    endTime: "16:00",
    timeBreak: "1:00",
  ),
];

final months = {
  'jan': 'Januar',
  'feb': 'Februrar',
  'mar': 'März',
  'apr': 'April',
  'may': 'Mai',
  'jun': 'Juni',
  'jul': 'July',
  'aug': 'August',
  'sep': 'September',
  'okt': 'Oktober',
  'nov': 'November',
  'dez': 'Dezember',
};

final years = {
  2024,
  2023,
  2022,
};

class TimesheetOverview extends StatelessWidget {
  const TimesheetOverview({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = ShadTheme.of(context);

    return Scaffold(
      appBar: AppBar(context, false),
      body: Padding(
        padding: const EdgeInsets.only(
          top: 20,
          left: 20,
          right: 20,
        ),
        child: SafeArea(
          child: Wrap(
            runSpacing: 15,
            children: [
              const TimesheetCard(
                overviewMode: false,
              ),
              Row(
                children: [
                  Expanded(
                    child: Padding(
                      padding: const EdgeInsets.only(right: 8.0),
                      child: ShadCard(
                        content: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          mainAxisAlignment: MainAxisAlignment.start,
                          children: [
                            Text(
                              "Überstunden",
                              style: theme.textTheme.large,
                            ),
                            Text(
                              "3:54",
                              style: theme.textTheme.h2,
                            ),
                            Text(
                              "2024",
                              style: theme.textTheme.p,
                            ),
                          ],
                        ),
                      ),
                    ),
                  ),
                  Expanded(
                    child: Padding(
                      padding: const EdgeInsets.only(left: 8.0),
                      child: ShadCard(
                        content: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          mainAxisAlignment: MainAxisAlignment.start,
                          children: [
                            Text(
                              "Vertrag",
                              style: theme.textTheme.large,
                            ),
                            Text(
                              "40:00",
                              style: theme.textTheme.h2,
                            ),
                            Text(
                              "Noch 13:00",
                              style: theme.textTheme.p,
                            ),
                          ],
                        ),
                      ),
                    ),
                  ),
                ],
              ),
              Padding(
                padding: const EdgeInsets.only(top: 12),
                child: Text("Bereits erfasst", style: theme.textTheme.h3),
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Expanded(
                    child: ShadSelect<String>(
                      placeholder: const Text('Monat'),
                      options: [
                        Padding(
                          padding: const EdgeInsets.fromLTRB(32, 6, 6, 6),
                          child: Text(
                            'Monate',
                            style: theme.textTheme.muted.copyWith(
                              fontWeight: FontWeight.w600,
                              color: theme.colorScheme.popoverForeground,
                            ),
                            textAlign: TextAlign.start,
                          ),
                        ),
                        ...months.entries.map((e) =>
                            ShadOption(value: e.key, child: Text(e.value))),
                      ],
                      selectedOptionBuilder: (context, value) =>
                          Text(months[value]!),
                    ),
                  ),
                  Expanded(
                    child: ShadSelect<String>(
                      placeholder: const Text('Jahr'),
                      options: [
                        Padding(
                          padding: const EdgeInsets.fromLTRB(32, 6, 6, 6),
                          child: Text(
                            'Jahre',
                            style: theme.textTheme.muted.copyWith(
                              fontWeight: FontWeight.w600,
                              color: theme.colorScheme.popoverForeground,
                            ),
                            textAlign: TextAlign.start,
                          ),
                        ),
                        ...years.map((e) => ShadOption(
                            value: e.toString(), child: Text(e.toString()))),
                      ],
                      selectedOptionBuilder: (context, value) => Text(value),
                    ),
                  ),
                ],
              ),
              Center(
                child: ConstrainedBox(
                  constraints: const BoxConstraints(
                    maxWidth: 600,
                    // added just to center the table vertically
                    maxHeight: 700,
                  ),
                  child: ShadTable.list(
                    columnSpanExtent: (index) {
                      if (index == 0) return const FixedTableSpanExtent(80);
                      if (index == 1) {
                        return const MinTableSpanExtent(
                          FixedTableSpanExtent(150),
                          RemainingTableSpanExtent(),
                        );
                      }
                      return const FixedTableSpanExtent(130);
                    },
                    rowSpanExtent: (row) {
                      return const FixedTableSpanExtent(60);
                    },
                    children: timesheets.map(
                      (timesheet) => [
                        ShadTableCell(
                          alignment: Alignment.center,
                          child: Wrap(
                            crossAxisAlignment: WrapCrossAlignment.center,
                            direction: Axis.vertical,
                            children: [
                              Text(
                                "${timesheet.date.day}",
                                textAlign: TextAlign.center,
                                style: theme.textTheme.large,
                              ),
                              Text(
                                DateFormat('EE', 'de_DE')
                                    .format(timesheet.date)
                                    .replaceAll(".", ""),
                                textAlign: TextAlign.center,
                                style: theme.textTheme.p
                                    .copyWith(color: primaryColor),
                              ),
                            ],
                          ),
                        ),
                        ShadTableCell(
                          child: Wrap(
                            direction: Axis.vertical,
                            children: [
                              Text(
                                "${timesheet.startTime} - ${timesheet.endTime}",
                                style: theme.textTheme.large,
                              ),
                              Text(
                                "Pause: ${timesheet.timeBreak}",
                                style: theme.textTheme.p,
                              ),
                            ],
                          ),
                        ),
                        const ShadTableCell(
                            alignment: Alignment.center,
                            child: Row(
                              crossAxisAlignment: CrossAxisAlignment.center,
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                ShadButton.secondary(
                                  padding: EdgeInsets.symmetric(horizontal: 8),
                                  icon: Icon(Icons.edit),
                                ),
                                ShadButton.destructive(
                                  padding: EdgeInsets.symmetric(horizontal: 8),
                                  icon: Icon(Icons.delete),
                                ),
                              ],
                            )),
                      ],
                    ),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Size on Buttons

I understand that this is in the early stages of development, but I had a thought.
Let me know if we should leave you alone during this early phase

Setting the size using ShadcnButtonSize is ignored if a height is set on the inherited theme.
Arguments on a widget itself should take precedence over the inherited theme.

https://github.com/nank1ro/shadcn-ui/blob/9c3278988be3160d2dbce226b50f7f943a1827f2/lib/src/components/button.dart#L286-L310

P.S. It would be awesome if the preset values could be inherited from the Theme.

Accordion API standardization

The animations of Accordion aren't using the same standard used by other components (flutter_animate with Effects).
Check if I find a way to implement SizeEffect and PaddingEffect to move it to the same standard.

Add missing `ColorScheme`s

I already implemented the zinc and slate color schemes, but there are other color schemes that need to be implemented.
You can find the HSL colors here https://github.com/shadcn-ui/ui/blob/main/apps/www/registry/themes.ts

The missing color scheme are:

  • Stone
  • Gray
  • Neutral
  • Red
  • Rose
  • Orange
  • Green
  • Blue
  • Yellow
  • Violet

Both the dark and light mode of each color scheme need to be implemented.

If you want to contribute, please comment with the color scheme you're going to implement, and I'll edit this post putting your nickname, so other users will not start the same color scheme.

Instructions

  1. Get the HSL from https://github.com/shadcn-ui/ui/blob/main/apps/www/registry/themes.ts
  2. To convert from shadcn to the Material Color you can do:
foreground: "240 10% 3.9%"
print('foreground: ${HSLColor.fromAHSL(1, 240, 0.10, 0.039).toColor()}');
  1. Set the obtained color in your lib/src/theme/color_scheme/NAME.dart where NAME is your color scheme name.

You can duplicate slate.dart and just change the file name, and the colors

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.