GithubHelp home page GithubHelp logo

teogor / gleam Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 390 KB

๐Ÿ”– Gleam effortlessly integrates modern, customizable bottom sheets into your Kotlin Compose app for a polished user experience.

Home Page: https://source.teogor.dev/gleam

License: Apache License 2.0

Kotlin 100.00%
bottom-sheet gleam kotlin kotlin-compose source-teogor source-teogor-dev teogor teogor-dev

gleam's Introduction

๐Ÿ‘‹๐Ÿป Hey there, I'm Teodor Grigor ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป

About Me

I'm a dedicated open-source enthusiast, Android engineer, video game developer, and UI/UX designer. My passion lies in crafting innovative solutions and making meaningful contributions to the open-source community.

Current Focus

I'm deeply engaged in developing open-source libraries for Android, with a specific focus on Kotlin Multiplatform (KMP). These libraries are geared towards enhancing the Android development landscape and offering valuable tools to fellow developers.

Supporting My Endeavors

I'm actively involved in contributing to open-source projects during my free time. Sponsorship plays a pivotal role in sustaining my efforts by covering essential expenses, allowing me to allocate more time to open-source work, and ensuring the continuity of my contributions without the constraints of a full-time job. If you'd like to support my endeavors, you can do so by visiting my sponsorship page.

Discover More About Me ๐ŸŒ

  • Dive into my portfolio at teogor.dev
  • Connect with me on LinkedIn ๐Ÿ’ผ
  • Catch up with me on Instagram ๐Ÿ“ธ
  • Explore my professional journey through my resume

Get in Touch ๐Ÿ“ฌ

Don't hesitate to reach out, connect, or delve into my work. I'm enthusiastic about collaborating and sharing knowledge with the open-source community! ๐Ÿš€

GitHub Stats

Teodor's GitHub Stats

Top Languages

gleam's People

Contributors

teogor avatar zeobot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

gleam's Issues

[FR]: Enhance GleamProperties with a more flexible and functional interface

Is there an existing issue for this?

  • I have searched the existing issues

Describe the problem

Current Implementation:

@ExperimentalGleamApi
class GleamProperties(
  val securePolicy: SecureFlagPolicy,
  val isFocusable: Boolean,
  val shouldDismissOnBackPress: Boolean,
  val animateCorners: Boolean,
  val animateHorizontalEdge: Boolean,
  val maxHorizontalEdge: Dp,
) {
  override fun equals(other: Any?): Boolean {
    if (this === other) return true
    if (other !is GleamProperties) return false

    if (securePolicy != other.securePolicy) return false
    if (isFocusable != other.isFocusable) return false
    return shouldDismissOnBackPress == other.shouldDismissOnBackPress
  }

  override fun hashCode(): Int {
    var result = securePolicy.hashCode()
    result = 31 * result + isFocusable.hashCode()
    result = 31 * result + shouldDismissOnBackPress.hashCode()
    return result
  }
}

Proposed Enhancement:

/**
 * Represents properties for configuring Gleam behavior.
 * @property securePolicy The policy for secure flag behavior.
 * @property isFocusable Whether the component is focusable.
 * @property shouldDismissOnBackPress Whether the component should dismiss on back press.
 * @property animateCorners Whether to animate corners.
 * @property animateHorizontalEdge Whether to animate the horizontal edge.
 * @property maxHorizontalEdge The maximum horizontal edge size.
 */
@ExperimentalGleamApi
interface GleamProperties {
  val securePolicy: SecureFlagPolicy
  val isFocusable: Boolean
  val shouldDismissOnBackPress: Boolean
  val animateCorners: Boolean
  val animateHorizontalEdge: Boolean
  val maxHorizontalEdge: Dp

  /**
   * Copies the current [GleamProperties] instance with optional property values overridden.
   *
   * @param securePolicy The policy for secure flag behavior.
   * @param isFocusable Whether the component is focusable.
   * @param shouldDismissOnBackPress Whether the component should dismiss on back press.
   * @param animateCorners Whether to animate corners.
   * @param animateHorizontalEdge Whether to animate the horizontal edge.
   * @param maxHorizontalEdge The maximum horizontal edge size.
   * @return A new instance of [GleamProperties] with the specified properties.
   */
  fun copy(
    securePolicy: SecureFlagPolicy = this.securePolicy,
    isFocusable: Boolean = this.isFocusable,
    shouldDismissOnBackPress: Boolean = this.shouldDismissOnBackPress,
    animateCorners: Boolean = this.animateCorners,
    animateHorizontalEdge: Boolean = this.animateHorizontalEdge,
    maxHorizontalEdge: Dp = this.maxHorizontalEdge
  ): GleamProperties
}

/**
 * Default implementation of [GleamProperties].
 * @param securePolicy The policy for secure flag behavior.
 * @param isFocusable Whether the component is focusable.
 * @param shouldDismissOnBackPress Whether the component should dismiss on back press.
 * @param animateCorners Whether to animate corners.
 * @param animateHorizontalEdge Whether to animate the horizontal edge.
 * @param maxHorizontalEdge The maximum horizontal edge size.
 */
data class DefaultGleamProperties(
  override val securePolicy: SecureFlagPolicy = SecureFlagPolicy.Inherit,
  override val isFocusable: Boolean = true,
  override val shouldDismissOnBackPress: Boolean = true,
  override val animateCorners: Boolean = false,
  override val animateHorizontalEdge: Boolean = false,
  override val maxHorizontalEdge: Dp = 0.dp,
) : GleamProperties {

  override fun copy(
    securePolicy: SecureFlagPolicy,
    isFocusable: Boolean,
    shouldDismissOnBackPress: Boolean,
    animateCorners: Boolean,
    animateHorizontalEdge: Boolean,
    maxHorizontalEdge: Dp
  ): GleamProperties = copy(
    securePolicy = securePolicy,
    isFocusable = isFocusable,
    shouldDismissOnBackPress = shouldDismissOnBackPress,
    animateCorners = animateCorners,
    animateHorizontalEdge = animateHorizontalEdge,
    maxHorizontalEdge = maxHorizontalEdge
  )
}

Describe the solution

Why This Enhancement is Valuable:

The updated GleamProperties interface provides a more flexible and maintainable approach to defining and manipulating properties for configuring Gleam behavior. By introducing an interface with a copy function and a default implementation, developers can easily create instances with overridden properties while ensuring consistency and type safety. This enhancement promotes cleaner code, reduces boilerplate, and aligns with modern Kotlin conventions, enhancing the usability and maintainability of the Gleam library.

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

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.